What you will build
You will submit a Sora 2 video job, store the returned video ID, poll until the job completes, and download the finished video content.Prerequisites
- A CometAPI API key stored in
COMETAPI_KEY - Python 3.10+ with
requests, or Node.js 18+ - A server-side worker or job queue for polling
API key, base URL, authentication
Create Sora jobs with:Code examples
Use the tabs below for copyable examples in cURL, Python, and Node.js.Flow explanation
Sora generation is asynchronous. The create endpoint returns a video ID and an initial status. PollGET /v1/videos/<video_id> until status is completed or failed. When the job is complete, download the file with GET /v1/videos/<video_id>/content.
Use exact WxH sizes. The Sora API reference documents standard landscape and portrait sizes, with larger Pro sizes for Pro model workflows.
Common parameters
| Parameter | Use |
|---|---|
model | Sora model ID. The reference example uses sora-2. |
prompt | Text prompt for the video. |
seconds | Clip duration. The API reference documents 4, 8, 12, 16, and 20. |
size | Exact WxH output size, such as 1280x720 or 720x1280. |
input_reference | Optional reference image file for first-frame workflows. |
Troubleshooting / FAQ
The create request fails
The create request fails
Use multipart form data. Sora create requests in the reference use form fields, not a JSON body.
The content download fails
The content download fails
Download content only after the status endpoint reports
completed. Store the finished file in your own storage.A Pro size does not work
A Pro size does not work
Use larger Pro sizes only with a Pro model workflow. Start with
1280x720 for a first request.Next steps
- Read the Create a Sora 2 video API reference.
- Poll with Retrieve a Sora 2 video.
- Download with Retrieve Sora 2 video content.
- Find available video models in Models.
- Review Use polling and webhooks for video generation.
- Estimate task cost with Estimate request cost before calling a model.