Browse documentation

Generate Video

Generate video through nRouter with the async /v1/videos flow, from submit to poll to download, using Veo and Sora through the same key as chat.

Generate a video with /v1/videos. Video rendering takes time, so the flow is asynchronous: one POST starts a job and returns its ID immediately, a GET polls the job until it completes, and a second GET downloads the finished file. Veo and Sora models run through the same key, budgets, and request logs as your chat traffic.

1. Start the job

curl -X POST https://api.nrouter.ai/v1/videos \
  -H "Authorization: Bearer $NROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo-2.0",
    "prompt": "Timelapse of city traffic at night with light trails in 4K.",
    "seconds": 5,
    "size": "1280x720"
  }'

The response is the job handle:

{ "id": "nrouter_video_01j89azxckm3287", "status": "queued", "model": "veo-2.0" }

Keep the id — the next two calls are addressed by it.

Job options

Four optional fields shape the render:

  • seconds — target duration; 5 by default, with supported values typically running 5 to 10 depending on the provider.
  • size — output resolution; 1280x720 by default, with 1920x1080 and 720x1280 (portrait) also available.
  • fps — frame rate, typically 24 or 30.
  • seed — an optional seed, for reproducible generation across runs.

2. Poll until it completes

curl https://api.nrouter.ai/v1/videos/nrouter_video_01j89azxckm3287 \
  -H "Authorization: Bearer $NROUTER_API_KEY"

While the job renders, the status reads processing with a progress percentage. When it reads completed, the video is ready — the poll reports progress: 100 and a completed_at timestamp. Poll every 3 to 5 seconds; polling faster can draw a 429, and if renders run long, back the interval off gradually toward 10 seconds. If the job fails, the poll returns the job's final status with an error in the standard nRouter error shape — see Errors & Rate Limits.

3. Download the file

curl https://api.nrouter.ai/v1/videos/nrouter_video_01j89azxckm3287/content \
  -H "Authorization: Bearer $NROUTER_API_KEY" \
  --output video.mp4

The content endpoint returns the video file itself. The job also appears in your request logs with its exact cost.

FAQ

Next steps

Was this page helpful?