Sora2图生视频
方法: POST路径: /v2/videos/generations
视频大概耗时 10s 预计生成时间 1-3 分钟 15s +2分钟 hd +8分钟 图片访问速度慢也会影响耗时,请尽量使用美国访问速度 较快的图片地址
关于审查,官方审查会涉及至少3个阶段/方向: 1、提交的图片中是否涉及真人(非常像真人的也不行) 2、提示词内容是否违规(暴力、色情、版权、活着的名人) 3、生成结果审查是否合格(这也是大家经常看到的生成了90%多后失败的原因)
常见错误: Inpaint image must match the requested width and height 使用官转分组时,图片分辨率需要与官方参数一致,例如 720x1280
请求参数
Header 参数
text
Content-Type
string
必需
示例:
application/json
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}Body 参数 application/json
text
prompt
string
必需
model
enum<string>
必需
枚举值:
sora-2
sora-2-pro
支持hd、15s
images
array
[string]
必需
图片列表,支持url、base64
aspect_ratio
enum<string>
输出比例
可选
枚举值:
16:9
横屏
9:16
竖屏
hd
boolean
可选
是否生成高清,默认false;高清会导致生成速度更慢; 仅 sora-2-pro 支持
duration
enum<string>
可选
视频时长;仅 sora-2-pro 支持25s
枚举值:
10
15
25
仅 sora-2-pro 支持25s
4
8
12
notify_hook
string
可选
watermark
boolean
可选
private
boolean
可选
示例
{
"prompt"
:
"string"
,
"model"
:
"sora-2"
,
"images"
:
[
"string"
]
,
"aspect_ratio"
:
"16:9"
,
"hd"
:
true
,
"duration"
:
"10"
,
"notify_hook"
:
"string"
,
"watermark"
:
true
,
"private"
:
true
}请求示例代码
Shell
bash
curl --location --request POST '/v2/videos/generations' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "string",
"model": "sora-2",
"images": [
"string"
],
"aspect_ratio": "16:9",
"hd": true,
"duration": "10",
"notify_hook": "string",
"watermark": true,
"private": true
}'返回响应
🟢 200 成功
内容类型: application/json
响应结构
text
object示例
json
{
"task_id": "f0aa213c-c09e-4e19-a0e5-c698fe48acf1"
}