创建视频
方法: POST路径: /v1/videos
https://platform.openai.com/docs/api-reference/videos/create
OpenAI Sora2 官方接口,推荐接入统一格式接口; 逆向分组和官方分组计费方式、时长设置不同
常见错误: Inpaint image must match the requested width and height 使用官转分组时,图片分辨率需要与官方参数一致,例如 720x1280
请求参数
Header 参数
text
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}Body 参数 multipart/form-data
text
model
enum<string>
必需
枚举值:
sora-2
sora-2-pro
示例:
sora-2
prompt
string
必需
示例:
基于这张图片生成视频
size
enum<string>
可选
Output resolution formatted as width x height. Defaults to 720x1280.
枚举值:
1280x720
720P横屏
720x1280
720P竖屏
1792x1024
1080P横屏
仅 sora-2-pro 支持
1024x1792
1080P竖屏
仅 sora-2-pro 支持
示例:
720x1280
input_reference
file
可选
示例:
https://example.com/reference.jpg
seconds
string
可选
Clip duration in seconds. Defaults to 4 seconds.
官方分组支持4秒以上,按秒计费
逆向分组仅支持 10、15、25(sora-2-pro支持)
示例:
4
watermark
boolean
可选
示例:
false请求示例代码
Shell
bash
curl --location --request POST '/v1/videos' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--form 'model="sora-2"' \
--form 'prompt="基于这张图片生成视频"' \
--form 'size="720x1280"' \
--form 'input_reference=@"https://example.com/reference.jpg"' \
--form 'seconds="4"' \
--form 'watermark="false"'返回响应
🟢 200 成功
内容类型: application/json
响应结构
text
object示例
json
{}