Video Generation

Submit a video generation request

Changed on

Submits a video generation request and returns a polling URL to check status

post/videos

Request

  • Base URL
    https://openrouter.ai/api/v1
  • Auth
    HTTP bearer

Request body

VideoGenerationRequest required
aspect_ratio, '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | '3:2' | '2:3' | '21:9' | '9:21' | '2:1' | '5:2'

Aspect ratio of the generated video. Omit it to use the model default, which on models with adaptive aspect ratio (e.g. BytePlus Seedance) follows the input image or video.

callback_url, string uri

URL to receive a webhook notification when the video generation job completes. Overrides the workspace-level default callback URL if set. Must be HTTPS.

creativity, integer

Creativity level for video upscaling models only. This parameter is not supported by video generation models.

duration, integer

Duration of the generated video in seconds, or -1 to let the provider choose the length (e.g. following an input video). -1 is only accepted by models that list it in supported_durations.

frame_images, FrameImage[]

Images to use as the first and/or last frame of the generated video. Each image must specify a frame_type of first_frame or last_frame, and each frame_type may appear at most once. Combining frame_images with input_references is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).

generate_audio, boolean

Whether to generate audio alongside the video. Defaults to the endpoint's generate_audio capability flag, false if not set. When neither is set, some providers (such as xAI) apply their own default and generate audio, so send false to request a silent video. Some models always include audio and ignore false. POST /videos returns 400 for true if every otherwise eligible endpoint explicitly disables audio generation.

input_references, InputReference[]

Reference assets to guide video generation. Accepts image, audio, and video references. POST /videos rejects the request with a 400 when the model or its provider integration does not support a supplied reference modality. Combining input_references with frame_images is provider-specific: some models reject the combination (as a 400 on submit or as a failed job), some use the frame images alone, and some use both (e.g. Runway applies image references as style/guidance alongside the frame anchors).

model, string required
previous_job_id, string

ID of a completed video job to edit or extend, as returned by the submit response. The new job runs on the same model and endpoint that produced the previous one. Only models that support continuation accept this field.

prompt, string

Text prompt describing the video to generate. Optional for models that support generating a video from image input alone; required by all other models.

provider, object

Provider routing preferences (order, only, ignore), request-level data policy (zdr, data_collection) and provider-specific passthrough configuration. Sorting by price, latency, or throughput and automatic provider fallbacks are not supported. No video endpoint currently offers Zero Data Retention, so zdr: true fails routing.

resolution, '360p' | '480p' | '720p' | '768p' | '1080p' | '1K' | '2K' | '4K'

Resolution of the generated video

seed, integer

If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. POST /videos returns 400 if every otherwise eligible endpoint explicitly declares seed unsupported.

session_id, string

A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.

size, string

Exact pixel dimensions of the generated video in "WIDTHxHEIGHT" format (e.g. "1280x720"). Interchangeable with resolution + aspect_ratio.

trace, TraceConfig

Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.

upscale_factor, number double

Upscale factor for video upscaling models only. This parameter is not supported by video generation models.

user, string

A unique identifier representing your end-user. Forwarded to Broadcast and private logging as the end-user id; never sent to the provider.

Example request

{
  "aspect_ratio": "16:9",
  "duration": 8,
  "model": "google/veo-3.1",
  "prompt": "A serene mountain landscape at sunset",
  "resolution": "720p"
}

Response

Video generation request accepted

VideoGenerationResponse required
error, string
expires_at, integer

Unix timestamp in seconds when OpenRouter's stored copy of the outputs stops being available. Present only when that copy exists.

generation_id, string

The generation ID associated with this video generation job. Available once the job has been processed.

id, string required

The video job ID, in the gen-vid-<timestamp>-<20 alphanumerics> generation ID format. Pass it as previous_job_id to continue the generation.

polling_url, string required

Absolute URL on the job’s OpenRouter regional host. Use it as returned to poll the job with your API key.

progress, number double

Percent complete, from 0 to 100 and possibly fractional, reported by the provider while status_detail is generating. Present only for providers that report it, and absent once the job moves to finalizing.

status, 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled' | 'expired' required
status_detail, 'submitting' | 'queued_at_provider' | 'generating' | 'finalizing'

The step within status for a job that is not finished: submitting and queued_at_provider under pending, generating and finalizing under in_progress. When present, it only moves forward, and steps may be skipped between polls. It is absent once the job is finished and can also be absent mid-job when the step is unknown, so use status to tell whether the job is finished.

unsigned_urls, string[]

Absolute URLs on the job’s OpenRouter regional host, one per output. Use the selected URL as returned with your API key in the Authorization header. It works while the output is available.

urls, string[]

Signed download URLs for OpenRouter's stored copy of each output, usable without an API key until expires_at. Anyone holding a URL can download that output until it expires, so treat it like a secret. Present only when the stored copy exists.

usage, VideoGenerationUsage

Usage and cost information for the video generation. Available once the job has completed.

Example response

{
  "generation_id": "gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt",
  "id": "gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt",
  "polling_url": "https://eu.openrouter.ai/api/v1/videos/gen-vid-1789480874-Ab3dEf9hIjKlMnOpQrSt",
  "status": "pending",
  "status_detail": "queued_at_provider"
}

Changes

    • info

      added the new optional request property provider/options/allOf[#/components/schemas/ProviderOptions]/celeris

    • info

      added the new Celeris enum value to the request property provider/ignore/items/anyOf[#/components/schemas/ProviderName]

    • info

      added the new Celeris enum value to the request property provider/only/items/anyOf[#/components/schemas/ProviderName]

    1 more change in this revision