Skip to content

Commit f40121e

Browse files
committed
Video generation: the ticket pattern lands on Sora, Veo, and grok-imagine
Job-shaped on every wire, so video reuses batch's idiom: video_generate returns a VideoJob (wait / result / re-attach by id / enumerate where the wire lists). One closed status vocabulary; wire words stay in provider_data. Results are honest VideoParts: bytes where the wire streams them (Sora content endpoint; Veo's file URI is key-bound — 403 without the header, verified live), a public URL on xAI. seconds maps Sora/Veo duration knobs and raises on xAI; input images raise on all three until live-receipted (xAI silently ignores unknown fields — the pixel-check lesson). No list endpoint on xAI: the ticket is the only copy, said in the error. sora-/veo- routing rules; EndpointSupport gains video; two serde kinds; vet video_op pair; async twins; recipe 14 graduates with all-real outputs (recipes 15-18 renumbered); live-proven on all three wires by re-attaching to today's captured jobs.
1 parent dbd08e5 commit f40121e

36 files changed

Lines changed: 1162 additions & 164 deletions

‎conformance/check_serde_fixtures.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class SerdeResult:
6464
"image_generation_response": (serde.image_generation_response_from_dict, serde.image_generation_response_to_dict),
6565
"speech_generation_request": (serde.speech_generation_request_from_dict, serde.speech_generation_request_to_dict),
6666
"speech_generation_response": (serde.speech_generation_response_from_dict, serde.speech_generation_response_to_dict),
67+
"video_generation_request": (serde.video_generation_request_from_dict, serde.video_generation_request_to_dict),
68+
"video_job": (serde.video_job_from_dict, serde.video_job_to_dict),
6769
}
6870

6971

‎conformance/serde/canonical.json‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,48 @@
12241224
"modelVersion": "gemini-2.5-flash-preview-tts"
12251225
}
12261226
}
1227+
},
1228+
{
1229+
"id": "video_generation_request.minimal",
1230+
"kind": "video_generation_request",
1231+
"value": {
1232+
"model": "grok-imagine-video",
1233+
"prompt": "A red ball bounces once"
1234+
}
1235+
},
1236+
{
1237+
"id": "video_generation_request.full",
1238+
"kind": "video_generation_request",
1239+
"value": {
1240+
"model": "sora-2",
1241+
"prompt": "A red ball bounces once",
1242+
"seconds": 4,
1243+
"extensions": {
1244+
"size": "720x1280"
1245+
}
1246+
}
1247+
},
1248+
{
1249+
"id": "video_job.minimal",
1250+
"kind": "video_job",
1251+
"value": {
1252+
"id": "video_1",
1253+
"status": "queued"
1254+
}
1255+
},
1256+
{
1257+
"id": "video_job.full",
1258+
"kind": "video_job",
1259+
"value": {
1260+
"id": "models/veo-3.1-lite-generate-preview/operations/0008ar3b1ksa",
1261+
"status": "completed",
1262+
"progress": 100,
1263+
"created_at": "2026-09-01T12:46:16Z",
1264+
"model": "sora-2",
1265+
"provider_data": {
1266+
"status": "done"
1267+
}
1268+
}
12271269
}
12281270
]
12291271
}

‎docs/cookbooks/01-first-request.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ one call in, one typed `Response` out.
174174
again.
175175
- **Direct LMs are for configuration, not preference.** Reach for them
176176
when you need a custom `base_url` or compat preset (ollama, vLLM —
177-
recipe [14](15-local-and-compatible-servers.md)) or when you are a
177+
recipe [14](16-local-and-compatible-servers.md)) or when you are a
178178
library taking an LM object from your caller.
179179
- **Async direct LMs exist too**: `AsyncOpenAILM`, `AsyncAnthropicLM`,
180180
`AsyncGeminiLM`, same constructors, awaitable `complete`.
@@ -188,4 +188,4 @@ one call in, one typed `Response` out.
188188
- [04 — Controlling generation](04-generation-config.md)
189189
- [05 — Streaming](05-streaming.md)
190190
- [Using the router](../using-the-router.md) — grammar, catalogs, credentials
191-
- [16 — Errors, retries & testing](16-errors-and-testing.md)
191+
- [17 — Errors, retries & testing](17-errors-and-testing.md)

‎docs/cookbooks/03-system-prompts.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ content is instructions, not transcript. On the wire:
107107

108108
`Message.developer()` is a fourth role alongside `user`, `assistant`,
109109
and `tool`. OpenAI keeps it as `role: "developer"` (configurable via
110-
compat — older Chat Completions servers want `"system"`; recipe 15).
110+
compat — older Chat Completions servers want `"system"`; recipe 16).
111111
Anthropic and Gemini providers convert it to a user message whose text
112112
is prefixed with `[developer]\n`. That is a convention, not an API
113113
guarantee: on those providers a developer message has whatever authority
@@ -140,7 +140,7 @@ request, your messages verbatim — what you build is what is sent.
140140
- **Fail-fast validation.** `Request(system="")` raises `ValueError`
141141
and protocol parts (tool calls, citations) in `system` raise
142142
`TypeError` — both at construction, before any network call
143-
(recipe 16).
143+
(recipe 17).
144144
- **System parts are text-only in practice.** All three providers
145145
flatten system parts to text before sending. Images or documents in
146146
instructions belong in a `user` or `developer` message instead
@@ -151,5 +151,5 @@ request, your messages verbatim — what you build is what is sent.
151151
- [02 — Multi-turn conversations](02-conversations.md)
152152
- [04 — Controlling generation](04-generation-config.md)
153153
- [11 — Prompt caching](11-caching.md)
154-
- [15 — Local & OpenAI-compatible servers](15-local-and-compatible-servers.md)
154+
- [16 — Local & OpenAI-compatible servers](16-local-and-compatible-servers.md)
155155
- [Using the router](../using-the-router.md)

‎docs/cookbooks/04-generation-config.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ other providers.
174174
preferred.
175175
- **Async mirror.** Identical `Config`, `await AsyncLMRouter().complete(request)`.
176176
- **Provider-only knobs** (`seed`, `frequency_penalty`, …) go in
177-
`Config(extensions=…)` — [recipe 17](17-provider-passthrough.md).
177+
`Config(extensions=…)` — [recipe 18](18-provider-passthrough.md).
178178

179179
## See also
180180

181181
- [03 — System & developer prompts](03-system-prompts.md)
182182
- [05 — Streaming](05-streaming.md)
183183
- [08 — Structured output](08-structured-output.md) — `response_format` in depth
184-
- [17 — Provider passthrough](17-provider-passthrough.md)
184+
- [18 — Provider passthrough](18-provider-passthrough.md)
185185
- [Using the router](../using-the-router.md)

‎docs/cookbooks/05-streaming.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ the layer above.
186186
- **Replay.** `lm15.result.response_to_events(response)` converts a
187187
complete `Response` back into a stream — useful for testing stream
188188
consumers without a network (recipe
189-
[15](16-errors-and-testing.md)).
189+
[15](17-errors-and-testing.md)).
190190

191191
## See also
192192

193193
- [01 — Your first request](01-first-request.md) — keys and the router front door.
194194
- [06 — Function tools](06-function-tools.md) — tool-call parts surfaced by `ResponseStream`.
195195
- [10 — Audio, video & reasoning models](10-audio-video-reasoning.md) — thinking deltas.
196-
- [16 — Errors, retries & testing](16-errors-and-testing.md) — stream errors, offline replay.
196+
- [17 — Errors, retries & testing](17-errors-and-testing.md) — stream errors, offline replay.
197197
- [Using the router](../using-the-router.md) — resolution rules and `RouterConfig`.

‎docs/cookbooks/06-function-tools.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,6 @@ which builds one `ToolResultPart` per entry.
218218

219219
- [07 — Built-in provider tools](07-builtin-tools.md)
220220
- [08 — Structured output](08-structured-output.md)
221-
- [16 — Errors, retries & testing](16-errors-and-testing.md)
221+
- [17 — Errors, retries & testing](17-errors-and-testing.md)
222222
- [Tools from functions](../tools-from-functions.md) — full derivation rules
223223
- [Using the router](../using-the-router.md)

‎docs/cookbooks/09-images-and-documents.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,5 @@ across all three. See [../using-the-router.md](../using-the-router.md).
226226
- [02 — Multi-turn conversations](02-conversations.md)
227227
- [10 — Audio, video & reasoning models](10-audio-video-reasoning.md)
228228
- [13 — Media generation (images & speech)](13-media-generation.md)
229-
- [16 — Errors, retries & testing](16-errors-and-testing.md)
229+
- [17 — Errors, retries & testing](17-errors-and-testing.md)
230230
- [../using-the-router.md](../using-the-router.md)

‎docs/cookbooks/10-audio-video-reasoning.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ does not estimate.
229229
- [05 — Streaming](05-streaming.md) — `Result.events()` and typed deltas.
230230
- [09 — Images, PDFs & documents](09-images-and-documents.md) — the
231231
other media parts, with broader provider support.
232-
- [14 — Live sessions (realtime)](14-live-sessions.md) — audio out, not
232+
- [15 — Live sessions (realtime)](15-live-sessions.md) — audio out, not
233233
just in.
234234
- [../using-the-type-system.md](../using-the-type-system.md) — parts,
235235
`Reasoning`, and `Usage` in full.

‎docs/cookbooks/12-batch-jobs.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ lm15 never falls back to silently looping `complete()` at full price.
166166

167167
- [13 — Media generation](13-media-generation.md) — the other non-chat
168168
endpoints.
169-
- [15 — Local & OpenAI-compatible servers](15-local-and-compatible-servers.md)
170-
- [16 — Errors, retries & testing](16-errors-and-testing.md) — the
169+
- [16 — Local & OpenAI-compatible servers](16-local-and-compatible-servers.md)
170+
- [17 — Errors, retries & testing](17-errors-and-testing.md) — the
171171
typed error tree entries carry.
172-
- [17 — Provider passthrough](17-provider-passthrough.md) — reading
172+
- [18 — Provider passthrough](18-provider-passthrough.md) — reading
173173
`provider_data`.

0 commit comments

Comments
 (0)