Skip to main content
Create a task → check its status → get the video URL. Replace the API key and confirm access to the example model and videos scope to generate a 5-second, 720p video. No media upload or separate estimate request is needed.
Run pip install requests, then copy and run this Python example to poll automatically and print the video URL.
On success, open download_url or url to download; failures are explained in error. Links expire after 15 minutes; query the task again for a fresh link. Save the task ID. If the script reaches its polling limit or a query is interrupted, keep querying the original task instead of creating another. Task stage distinguishes waiting_submission, submitting, upstream_queued, generating, saving, completed, failed and verification_pending. status and billing fields remain compatible. request_id identifies the request; created_at and completed_at are platform timestamps, not model computation or browser first-frame times. Poll every 5 seconds while processing or settlement is pending, and stop after completion and settlement. A saving task may return save_retrying=true; keep querying the same task. Only a failed task with retryable=true can be regenerated with a new idempotency key and n=1, and it will be charged as a new request. error.category distinguishes input_review, output_review and copyright; the original upstream code is available in error.provider_code. Queue capacity and rate limits return 429; retry later. Unknown submissions and incomplete usage require verification, never automatic regeneration.