Skip to main content
OpenRouter provides a dedicated asynchronous API for generating videos from text prompts, start and end frame images, and multimodal references. Because video generation takes significantly longer than text or image generation (typically 30 seconds to several minutes), requests follow an asynchronous submit-poll-download lifecycle.

Endpoints

The Video Generation API consists of four endpoints:

End-to-end workflow

Video generation follows three sequential steps:
  1. 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).
  2. Poll: Query GET /api/v1/videos/{jobId} at regular intervals (recommended: every 10–30 seconds) until status reaches a terminal value: completed, failed, cancelled or expired. Alternatively, supply a callback_url to receive a webhook notification upon completion.
  3. Download: Once completed, retrieve the generated video using either the signed storage URL (urls[0]) or the authenticated content proxy endpoint (unsigned_urls[0]).
In a multi-user app, one API key can poll, download, and continue every job the app created. Record which end user owns each job ID, and check that ownership before you act on a job ID supplied by a client.

cURL example

TypeScript example

Python example

Job lifecycle and statuses

The status 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}/content only after a poll returns status: "completed". Before then the content endpoint returns 404 with Job <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, set callback_url and 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 completed job can briefly report in_progress while its result is still being stored. Keep polling until status is terminal.
  • Generated videos are not kept forever. expires_at is when OpenRouter’s stored copy and signed urls expire. After that, the content endpoint may still serve the video from the provider until the provider deletes it, which returns 410 or, for some providers, a 5xx. 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 Authorization header 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 urls to 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 urls is absent or expired.
  • Streaming in web apps: Because browser <video> tags cannot attach custom Authorization headers, never send unsigned_urls directly to the client browser with client-side API keys. Instead, implement a thin server-side proxy route in your web framework (e.g., Next.js app/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), fetches GET /api/v1/videos/{jobId}/content using your server’s OPENROUTER_API_KEY, and pipes the video/mp4 response 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:
Each model entry includes capability matrices and pricing units:

Parameter support by model

Use the model’s entry in GET /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:
To filter models by the job you want to run, follow Choose a video model.

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 with status: "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/videos with a 4xx are not billed. A 5xx from submit can leave the outcome unknown: the job may still have started and can complete and bill. Don’t blindly resubmit after a 5xx, 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.cost on 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 usage only for completed jobs, so a failed job without usage.cost may still have been charged. Check your activity before you assume a retry won’t add a charge.

Webhooks and signature verification

When callback_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 a callback_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:
Verify signatures using the raw, unparsed request body:
Each delivery also carries an 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 HTTP 400 error.