Repository navigation
Description
Area: Proxy and routing
What are you trying to accomplish?
I use images.provider to route Codex's image_gen tool to a self-hosted, OpenAI-compatible media bridge, and it works exactly as hoped: the provider's baseUrl and API key are honored, and generation fails closed rather than falling back to a hosted account. I want the same choice for video — when a non-OpenAI routed model calls the injected video_gen tool, the submit and poll traffic should reach the video backend of my choice (a local bridge or any vendor exposing an xAI-compatible async video API), so agents can generate video the same way they generate images today.
What prevents this today?
The video bridge pins its destination. In src/images/plan.ts, planVideoBridge resolves the base URL from the hardcoded registry entry for xai and explicitly ignores any provider-level baseUrl override (the code comment reads: "Pin the baseUrl to the registry entry, ignoring any config-level baseUrl override"). That entry's baseUrl is the constant https://api.x.ai/v1 in src/providers/registry/entries-core.ts. So video_gen can only ever talk to xAI:
- There is no
videos.providerequivalent ofimages.provider(whichsrc/server/images.tshonors live, without a restart). - Naming a provider
xaiand pointing itsbaseUrlelsewhere does not help — the pin bypasses it. - No environment variable overrides it.
The transport itself is one step away from provider-agnostic: src/images/xai-video-client.ts takes auth: { baseUrl, token } as a parameter on both submitVideoJob and pollVideoJob, so honoring a provider's base URL is a small change at the planning layer.
(Verified on 2.97.0, macOS, npm install.)
What should OpenCodex do?
Mirror the images hook: when images.videoBridgeEnabled is true and a new knob such as images.videoProvider names a configured provider, the video_gen tool's submit call (POST {provider baseUrl}/videos/generations) and poll call (GET {provider baseUrl}/videos/{id}) should go to that provider, authenticated with that provider's API key — the same fail-closed, live-honored behavior images.provider gives /v1/images today. With no videoProvider set, keep the current xAI behavior unchanged.
Example usage or interface
{
"providers": {
"my-video-bridge": {
"adapter": "openai-chat",
"baseUrl": "http://127.0.0.1:8790/v1",
"apiKey": "local",
"authMode": "key",
"allowPrivateNetwork": true
}
},
"images": {
"videoBridgeEnabled": true,
"videoProvider": "my-video-bridge",
"videoBridgeModel": "grok-imagine-video"
}
}A non-OpenAI model calls video_gen(prompt, duration, resolution, aspect_ratio); OpenCodex submits to the configured provider's /videos/generations, polls {base}/videos/{id} until status: "done", then downloads video.url into the artifacts directory — identical to the xAI path today, only the destination changes. videoBridgeModel already flows through as the request's model field, so backend-specific model ids need no extra plumbing.
Alternatives or workarounds
None that survive config-only. Pointing a provider named xai at a custom baseUrl fails silently because of the registry pin, and there is no env override. The only working path is patching planVideoBridge to honor the provider's baseUrl — two lines — which every npm update / reinstall of the package reverts, so it is not a real workaround. The wire client's lenient parsing (request_id or id, status or state aliases, video.url or videos[0].url) already suits third-party backends, which is what makes this small hook genuinely useful beyond xAI.
Additional context
- Parity reference:
images.provideris honored live by the relay (no restart), documented in the Image Bridge guide; the video bridge config already lives beside it underimages.*(videoBridgeEnabled,videoBridgeModel,videoMaxRounds,videoTimeoutMs), sovideoProviderlands naturally in the same block. planImageBridgeshares the same registry pin, so one fix at the planning layer — honor the provider'sbaseUrlwhen a bridge provider is explicitly configured — could cover both bridges.- I built a local bridge implementing the exact submit/poll contract from
xai-video-client.ts; against it, only the hardcoded destination blocks the flow, which is what prompted this request.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
github-actions commentedon Nov 4, 2026
Automated translation bookkeeping — detected language: English.
Ingwannu commentedon Nov 7, 2026
Confirmed on
dev(aaa3c20f3f):planVideoBridgetakes the key from the provider thatfindXaiProviderreturns. It sends the request to the base URL of the registry'sxaientry, not to that provider'sbaseUrl(src/images/plan.ts:143-145). The in-turn image bridge (planImageBridge,:78-80) does the same.images.provideronly selects the backend for the/v1/imagesendpoint (src/server/images.ts:666), not the in-loopimage_gen/video_genbridges, so there is no existing setting for this.Scope: parity with
images.provideris reasonable. It does change where a credential is sent, so it needs explicit security review.Design points:
videoProvidershould use only its ownbaseUrland key. Anxaiprovider's key must never follow abaseUrloverride; that is what the fixed URL protects today.allowPrivateNetwork, like other provider traffic.downloadVideoToArtifact(src/images/artifacts.ts:468) accepts a base64data:URL or a public HTTPS URL only. A local bridge that returnshttp://127.0.0.1/...asvideo.urlwould still be refused. What does your bridge return?videoProvidernames a provider that is missing, disabled or has no key, fail without falling back to xAI, asimages.providerdoes.No commitment to implement yet.
lidge-jun commentedon Nov 16, 2026
Owner decision (lidge-jun, 2026-11-16): add a
videoProvidersetting, symmetric withimages.provider: only the chosen provider's base URL and key are used, a missing provider fails closed, and an xAI key is never sent to another host. Security review before merge.bradhallett commentedon Nov 16, 2026
On
video.urlfrom my bridge: it returns the upstream vendor's hosted public HTTPS URL — the run output's asset link passed through unchanged (asvideo: { url: urls[0] }, plusvideos: [{ url }]for the lenient parser). SodownloadVideoToArtifactaccepts it today — no downloader change is needed for this PR.Recommendation for the spec: keep the downloader's current rule —
video.urlis a public HTTPS URL or adata:base64 URL; loopbackhttp://127.0.0.1/...URLs stay refused. If fully-local bridges want loopback delivery later, that is a separate downloader issue with its ownallowPrivateNetworkdiscussion, not scope here.Thanks for the decision. I'm preparing a PR against
dev:images.videoProviderat the planning layer — the named provider's ownbaseUrland key only, fail closed when missing, disabled, or keyless, and an xAI key never sent to another host. Focused regression tests included; the PR will reference the decision comment.feat(images): add images.videoProvider for custom video bridge destin…
fix(images): case-insensitive registry guard for videoProvider
feat(images): route video_gen to images.videoProvider (lidge-jun#8783)