Endpoints
The Video Generation API consists of four endpoints:End-to-end workflow
Video generation follows three sequential steps:- Submit: Send a generation request with a video model and prompt to
POST /api/v1/videos. Receive a job ID (id) and relative polling URL (polling_url). - Poll: Query
GET /api/v1/videos/{jobId}at regular intervals (recommended: every 10–30 seconds) untilstatusreaches a terminal value:completed,failed,cancelledorexpired. Alternatively, supply acallback_urlto receive a webhook notification upon completion. - Download: Once completed, retrieve the generated video using either the signed storage URL (
urls[0]) or the authenticated content proxy endpoint (unsigned_urls[0]).
cURL example
TypeScript example
Python example
Job lifecycle and statuses
Thestatus field on GET /api/v1/videos/{jobId} reflects the current state of generation:
While a job is in flight, the response can also carry
status_detail, the step within status, and progress:
A job becomes pollable once the provider accepts it, so most polls start at
queued_at_provider. status_detail only moves forward when present, and a fast job can skip steps between polls. It is absent once the job is finished and can be absent mid-job when the step is unknown, so use status to tell whether the job is finished.
progress is the percent complete, from 0 to 100, while status_detail is generating. Only providers that report a percent send it.
Polling and retrieval
- Call
GET /api/v1/videos/{jobId}/contentonly after a poll returnsstatus: "completed". Before then the content endpoint returns404withJob <id> is not completed (status: <status>), and the request does not move the job forward. - Poll every 10–30 seconds and back off on
429. For long jobs or many concurrent jobs, setcallback_urland wait for the webhook instead of polling. Keep a timeout and a fallback poll anyway: if webhook delivery exhausts its retries, the job can complete and be billed without your application hearing about it. - A
completedjob can briefly reportin_progresswhile its result is still being stored. Keep polling untilstatusis terminal. - Generated videos are not kept forever.
expires_atis when OpenRouter’s stored copy and signedurlsexpire. After that, the content endpoint may still serve the video from the provider until the provider deletes it, which returns410or, for some providers, a5xx. Download or copy the video to your own storage soon after the job completes.
Downloading outputs: urls vs unsigned_urls
When a job reaches status: "completed", the response payload provides two distinct ways to access the generated video:
1. Pre-signed storage URLs (urls)
- Authentication: No
Authorizationheader required. - Validity: Temporary, valid until the Unix timestamp in
expires_at. - Use case: Safe for direct client browser playback (
<video src={urls[0]}>) or direct download links without exposing your OpenRouter API key. - Availability: Present when OpenRouter’s edge media storage has cached the output. Because these URLs grant direct read access while valid, treat them as bearer secrets.
- Multi-user apps: Your API key can read every job your app created, so before returning
urlsto an end user, check that the requested job belongs to that user. Otherwise one user can play another user’s video by passing its job ID.
2. Authenticated content endpoint (unsigned_urls)
- Authentication: Requires
Authorization: Bearer <OPENROUTER_API_KEY>. - Validity: Permanent for as long as the generation record is retained.
- Use case: Server-side processing, archival pipelines, or backend streaming proxies when
urlsis absent or expired. - Streaming in web apps: Because browser
<video>tags cannot attach customAuthorizationheaders, never sendunsigned_urlsdirectly to the client browser with client-side API keys. Instead, implement a thin server-side proxy route in your web framework (e.g., Next.jsapp/api/videos/[id]/route.ts) that verifies the user session, checks that the requested job belongs to that user (your API key can read every job your app created), fetchesGET /api/v1/videos/{jobId}/contentusing your server’sOPENROUTER_API_KEY, and pipes thevideo/mp4response back to the client.
Request parameters
POST /api/v1/videos accepts the following parameters:
Image-to-video (frame_images)
To animate an existing image into a video, supply one or two frame images in frame_images. Supported frame types are first_frame (starts the clip from this image) and last_frame (ends the clip at this image):
Reference-to-video (input_references)
Reference-to-video guides character consistency, aesthetic style, or scene composition without locking the video to an exact starting pixel frame:
Model discovery
Query the dedicated Video Models endpoint to retrieve supported parameters, resolutions, durations, and pricing SKUs for every video model currently deployed:Parameter support by model
Use the model’s entry inGET /api/v1/videos/models to choose parameter values before you submit. Each entry describes one endpoint for the model, so treat the lists as discovery hints rather than a guarantee for every provider: if you pin a different provider with provider, it can reject a listed value or accept an unlisted one. Unsupported values are usually rejected with 400, either by OpenRouter before the job is sent or by the provider. Some providers instead ignore a setting they can’t apply, for example an aspect_ratio on image-to-video that follows the first frame’s geometry, so a successful job doesn’t guarantee every parameter was used.
A
null field means the model does not advertise a list, so OpenRouter does not restrict that parameter, and the provider can still reject unsupported values. upscale_factor and creativity are stricter: sending either returns 400 unless an eligible endpoint advertises support. Another exception is duration: -1 (automatic duration): it needs explicit endpoint support and can return 400 even when supported_durations is null. previous_job_id works only on models whose provider supports continuing a job, and the referenced job must be a completed job from your account.
To list what every model supports:
Errors
Errors returned by an endpoint use the standard OpenRouter error body,{"error": {"code": <HTTP status>, "message": "...", "metadata": {...}}}. The message text describes the specific cause; the tables below list the causes by status. See Errors and debugging for the shared format.
Errors from POST /api/v1/videos
These errors are returned before the job is created, so no job ID is issued and you are not charged.
Errors from GET /api/v1/videos/{jobId} and /content
Failed jobs
A job that the provider accepted but couldn’t finish ends withstatus: "failed", "cancelled", or "expired", and the poll response and webhook carry an error string. For example, a video that the provider’s output moderation blocked fails with Generated video rejected by content moderation. Change the prompt or inputs before you retry; resubmitting the same request usually fails the same way.
Billing
- Requests rejected by
POST /api/v1/videoswith a4xxare not billed. A5xxfrom submit can leave the outcome unknown: the job may still have started and can complete and bill. Don’t blindly resubmit after a5xx, because a retry can create a second paid job. - When a job is accepted, OpenRouter places a hold for its estimated cost against your balance and key limit. The hold counts toward your spend while the job runs.
- A job is billed when it completes with a usable video. The final cost is in
usage.coston the poll response. - If the job fails, is cancelled, expires, or completes without a retrievable video, the hold is usually released and you are not charged. Two exceptions: a job can fail and still be charged when the provider reports billable usage for output it blocked in moderation, and a completed job can be billed when OpenRouter can’t confirm whether its output is available. The poll response includes
usageonly for completed jobs, so afailedjob withoutusage.costmay still have been charged. Check your activity before you assume a retry won’t add a charge.
Webhooks and signature verification
Whencallback_url is configured on the request (or set as the workspace default in Workspace Settings), OpenRouter sends an HTTPS POST payload upon job completion, failure, expiration, or cancellation.
Webhook payload example
Verifying signatures
Setting acallback_url doesn’t create a signing secret. To get one, open your workspace settings and select Generate signing secret under Webhook signing secret; video and batch deliveries share it. With a secret configured, OpenRouter includes an X-OpenRouter-Signature header on every delivery containing a timestamp (t) and HMAC-SHA256 hash (v1). Without one, deliveries are unsigned and can’t be told apart from a forged request, so reject any delivery whose signature header is missing or invalid with a non-2xx response:
X-OpenRouter-Idempotency-Key header of the form <jobId>-<status>. Failed deliveries are retried, so use the key to deduplicate them. Record it in the same transaction that applies the event, return a non-2xx response if processing fails so the retry can recover, and acknowledge a key you’ve already recorded without acting on it again.
Zero Data Retention (ZDR) policy
Video generation is not eligible for Zero Data Retention (ZDR). Because video generation is asynchronous, provider endpoints must temporarily retain the generated media artifact so your application can retrieve it via the polling or content download endpoints. If your account or API key enforces ZDR mode, video generation requests will be rejected with an HTTP400 error.