Skip to navigation

Create a video generation

View as Markdown

Recommended flow: first call POST /v1/videos/prepare to choose and validate the model settings and review the preliminary estimated_price. Then send those same settings plus the final prompt in this request. The prepare endpoint does not accept a prompt or start a generation. This endpoint starts an asynchronous video generation; no defaults are applied to required settings. Validation checks resolution, then aspect_ratio for that resolution, then size for the selected pair; a 400 validation detail includes allowedValues. Use GET /v1/models?type=video to find available models, poll generation_id until completed, then fetch content_url. The MP4 artifact is retained in R2 for 30 days.

Authentication

AuthorizationBearer

API key passed as Authorization: Bearer token.

Headers

Idempotency-KeystringOptional
Optional key to make retries of the same create request idempotent.

Request

This endpoint expects an object.
modelstringRequired

Video model ID. Find supported IDs using GET /v1/models?type=video.

promptstringRequired<=10000 characters
Text prompt describing the video to generate. Maximum length is 10,000 characters.
durationintegerRequired
Duration in seconds. Must be supported by the selected model.
resolutionstringRequired
Output resolution supported by the selected model.
aspect_ratiostringRequired
Output aspect ratio supported by the selected resolution.
sizestringRequired
Output size supported by the selected model.
generate_audiobooleanOptional
Whether to generate audio when the selected model supports it.
seedintegerOptional
Optional deterministic seed when supported by the selected model.
referenceslist of objectsOptional

Optional image or video inputs. Supply owned file IDs; external URLs are not accepted.

Response

Video generation accepted
generation_idstring
statusenum
promptstring
created_atdatetime
modelstring or nullOptional
completed_atdatetime or nullOptional
content_urlstring or nullOptionalformat: "uri"
Available after completion. Fetching this URL redirects to the generated MP4 stored in R2. The artifact is retained for 30 days, then removed by the hourly cleanup job.
failure_codestring or nullOptional
failure_messagestring or nullOptional

Errors

400
Bad Request Error
402
Payment Required Error
503
Service Unavailable Error