Repository navigation
feat(images): add images.videoProvider for custom video bridge destination #8784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e38ed76
0be7f3f
175c54b
70643ac
a6ae741
19e7915
e9b62aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,12 @@ job to xAI, polls until completion, and downloads the result. | |
|
|
||
| ## Prerequisites | ||
|
|
||
| - An `xai` provider entry with an **API key** (`ocx login xai` alone is not sufficient — the video bridge requires key auth, not OAuth) | ||
| - An `xai` provider entry with an **API key** (`ocx login xai` alone is not sufficient — the video bridge requires key auth, not OAuth) — unless `images.videoProvider` names another key-auth provider, which then supplies both the destination and the credential | ||
| - A non-OpenAI model as your routed provider (e.g. Anthropic Claude, Google Gemini) | ||
| - opencodex configured to route through the non-OpenAI provider | ||
|
|
||
| > **⚠ Provider key required:** The video bridge only activates when the `xai` provider uses | ||
| > API key auth. Add this to your config: | ||
| > **⚠ Provider key required:** With no `videoProvider` set, the video bridge only activates when | ||
| > the `xai` provider uses API key auth. Add this to your config: | ||
| > | ||
| > ```json | ||
| > { | ||
|
|
@@ -51,12 +51,61 @@ Add `videoBridgeEnabled: true` to your `images` config: | |
| | `videoBridgeModel` | `"grok-imagine-video"` | xAI video model id. | | ||
| | `videoMaxRounds` | `2` | Max video-gen rounds before forced final answer. | | ||
| | `videoTimeoutMs` | `300000` (5 min) | Per-video timeout including polling. | | ||
| | `videoProvider` | *(unset)* | Custom video bridge destination (#8175). Names a configured provider; only its own `baseUrl` and API key are used. | | ||
|
|
||
| ### Custom video provider | ||
|
|
||
| By default the video bridge talks to xAI's pinned endpoint. Set `images.videoProvider` to the | ||
| name of a configured provider to route the `video_gen` submit and poll calls elsewhere — | ||
| for example a self-hosted bridge or any vendor exposing an xAI-compatible async video API | ||
| (same contract: `POST {baseUrl}/videos/generations`, poll `GET {baseUrl}/videos/{id}`): | ||
|
|
||
| ```json | ||
| { | ||
| "providers": { | ||
| "my-video-bridge": { | ||
| "adapter": "openai-chat", | ||
| "baseUrl": "http://127.0.0.1:8790/v1", | ||
| "apiKey": "${VIDEO_BRIDGE_KEY}", | ||
| "authMode": "key", | ||
| "allowPrivateNetwork": true | ||
| } | ||
| }, | ||
| "images": { | ||
| "videoBridgeEnabled": true, | ||
| "videoProvider": "my-video-bridge", | ||
| "videoBridgeModel": "grok-imagine-video" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| The named provider's own `baseUrl` and API key are the only destination and credential used: | ||
| fail closed, never falling back to xAI, and an xAI key is never sent to another host. The bridge | ||
| stays **silently unarmed** in every one of these cases: | ||
|
|
||
| - the named provider is missing, disabled, or has no usable API key | ||
| - the named provider uses OAuth or forward auth — the video client sends a static bearer key, so | ||
| those auth modes are rejected rather than downgraded | ||
| - the named provider's `baseUrl` is not an absolute http(s) URL | ||
| - `videoProvider` is present but not a provider name (`42`, `true`, `null`) or names the reserved | ||
| registry id `xai` — a built-in registry entry is never adopted as the bridge destination, so an | ||
| `xai` entry's `baseUrl` override can never carry the xAI key to another host | ||
|
|
||
| A blank `videoProvider` (`""` or whitespace) is treated as unset, keeping the pinned xAI default. | ||
| `allowPrivateNetwork: true` is required for loopback/private destinations, exactly as for any | ||
| provider `baseUrl`. | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| > **Delivery still requires a fetchable URL.** Submit and poll may succeed against a custom | ||
| destination, but the finished video is downloaded into the artifacts directory only when | ||
| `video.url` is a public HTTPS URL or an inline `data:` URL. A bridge whose `video.url` points at | ||
| `http://127.0.0.1/...` (or any non-public address) will generate the video and then fail at the | ||
| download step — return a hosted URL or a base64-encoded `data:` payload (`data:video/mp4;base64,…`) | ||
|
|
||
| ## How It Works | ||
|
|
||
| 1. opencodex detects a non-OpenAI routed model with `videoBridgeEnabled: true` | ||
| 2. A synthetic `video_gen` function tool is injected into the conversation | ||
| 3. When the model calls `video_gen`, opencodex submits a job to xAI's `/videos/generations` | ||
| 3. When the model calls `video_gen`, opencodex submits a job to `/videos/generations` — on xAI by default, or on the provider named by `images.videoProvider` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the xAI-only routing statements in the ja, ko, ru, and zh-cn video bridge guides. The English guide now lets
A reader of these pages gets an incorrect destination. Update each page to state that xAI is the default and that The
|
||
| 4. The bridge polls the job status every 5-15 seconds, sending heartbeat messages to keep the stream alive | ||
| 5. When the video is ready, it's downloaded to the artifacts directory | ||
| 6. The local file path is returned to the model as a tool result | ||
|
|
@@ -74,7 +123,7 @@ The `video_gen` tool accepts: | |
|
|
||
| ## Limitations | ||
|
|
||
| - **xAI only**: Video generation is only available through xAI's Grok Imagine Video API | ||
| - **xAI only**: Video generation targets xAI's Grok Imagine Video API by default; set `images.videoProvider` to a configured provider to use a custom destination (#8175) | ||
| - **Asynchronous**: Video generation takes 30-120 seconds | ||
| - **Cost**: video generation is a paid xAI feature. Check the [official pricing](https://docs.x.ai/developers/pricing) before using it. | ||
| - **One video per call**: Each `video_gen` call produces one video | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the Spanish xAI-key prerequisite to match the custom-provider path.
The English guide allows
images.videoProviderto name another key-auth provider in place of the xAI key. The Spanish prerequisite list and callout still require anxaiprovider with an API key, with no exception. The Spanish overview already describes theimages.videoProviderpath, so the two sections conflict. The English guide is the canonical source, and the docs-site rules say translated content must not contradict it.Update the prerequisite item and the callout to add the same exception as the English guide. The Chinese guides (zh-cn, zh-tw) use the same unconditional wording and should be synchronized in the same change.
Suggested fix
Source: Path instructions