创建一个 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 的 base URL 和 key。完成后的下载 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.