建立 Sora 2 影片
使用 POST /v1/videos 從文字 Prompt 或參考圖片建立 Sora 2 影片生成任務,然後透過任務 ID 輪詢狀態以取得結果。
從最小且實用的任務開始
- 使用
sora-2以更快迭代,或在輸出品質比速度更重要時使用sora-2-pro - 在第一次請求時,將
seconds設為4 - 除非你明確需要直向輸出,否則先使用
size: 1280x720 - 最多只上傳一張參考圖片
時長與尺寸
size 欄位必須採用精確的 WxH 格式。像 720p 這類解析度標記,以及像 16:9 這類比例標籤,都不是此端點上有效的 Sora size 值。
端到端流程
建立渲染工作
model、prompt、seconds 和 size,然後儲存回傳的 id。輪詢直到工作完成
completed 或 failed。下載結果
仍然適用的 Sora 行為
OpenAI 在 Videos API 中記錄了相同的 create -> retrieve -> download 流程。在 CometAPI 上,你可以保留 Sora 的請求結構,但要使用 CometAPI 的基底 URL 和金鑰。完成後的下載 URL 是暫時性的,因此如果你需要長期保存,請將已完成的資產複製到你自己的儲存空間。授權
Bearer token authentication. Use your CometAPI key.
主體
Text prompt that describes the video you want to create.
"A paper airplane glides across a desk."
Sora model ID. Choose an available model from the Models page.
"sora-2"
Clip duration in seconds. Use 4, 8, 12, 16, or 20.
4, 8, 12, 16, 20 "4"
Output resolution formatted as width x height. Use 1280x720 or 720x1280 for standard Sora output. Use 1792x1024 or 1024x1792 with a Pro model when you need larger Pro output.
720x1280, 1280x720, 1024x1792, 1792x1024 "1280x720"
Optional reference image uploaded as a file. The image should match the target size you request.