通用开放接口视频 API
POST /v1/multi/videos
POST
/v1/multi/videos多模态视频生成。通过 mode 指定生成模式,通过 assets[] 传入图片/视频 URL。
提交成功后,使用 GET /v1/videos/{task_id} 查询、GET /v1/videos/{task_id}/content 下载。
鉴权:Bearer Token
Content-Type:application/json
生成模式 mode
mode | 说明 | 典型必填资产 |
|---|---|---|
t2v | 文生视频 | 无 |
i2v | 图生视频 | image |
first_frame | 首帧生成视频 | first_frame |
last_frame | 尾帧生成视频 | last_frame |
first_last_frame | 首尾帧生成视频 | first_frame、last_frame |
ref_image | 参考图生成视频 | 至少 1 条 reference_images |
ref_media | 全能参考生成视频(多参考媒体混合) | 无强制媒体资产;prompt 必填,reference_images / source_video / audio 均可选 |
video_extend | 视频续写 | source_video |
video_edit | 视频智能编辑 | source_video;可选 reference_images |
各模型启用的
mode以管理台「模型能力 → 视频能力」配置为准。
全能参考生成视频(ref_media)
ref_media(全能参考生成视频)是输入能力最强的多参考模式:在同一条提示词下,同时混合参考图片、参考视频、参考音频生成新视频,典型模型为 minimax-h3。与 ref_image 只支持参考图不同,ref_media 允许三类媒体自由组合(可只传其中任意一种或多种)。
资产角色与默认上限
assets[].role | 说明 | 数量上限(默认) | 单文件大小上限(默认) | 总时长上限(默认) |
|---|---|---|---|---|
reference_images | 参考图片 | 4 张(可配 1–14) | 20MB | — |
source_video | 参考视频 | 1 个(可配 0–14,0 表示不支持) | 40MB | 15s |
audio | 参考音频 | 1 个(可配 1–14) | 10MB | 15s |
上限值由管理台「编辑模型 → 视频能力 → 全能参考生成视频(ref_media)」配置,C 端与 API 校验均以该配置为准;未配置时使用上表默认值。
资产字段
ref_media 模式下 assets[] 除 role、url 外,还可携带:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
role | string | 是 | reference_images / source_video / audio |
url | string | 是 | 媒体文件 URL |
duration_sec | number | 条件 | 媒体时长(秒);source_video 必填,audio 可选 |
resolution | string | 否 | 参考视频分辨率,用于计费归一(如 720p、1080p) |
size_bytes | integer | 否 | 文件大小(字节),用于单文件大小校验 |
校验规则
prompt必填,最大字符数默认 6000(prompt_max_chars,可配 1–20000)- 所有参考资产总数(图 + 视频 + 音频之和)不超过
max_reference_items,默认 12(可配 1–100) source_video资产必须携带duration_sec;所有参考视频时长之和不超过max_reference_video_duration_sec,默认 15s(可配 1–600)- 所有参考音频时长之和不超过
max_reference_audio_duration_sec,默认 15s(可配 1–600) - 各类资产单文件大小分别受
max_reference_video_size_mb/max_reference_image_size_mb/max_reference_audio_size_mb限制,默认 40MB / 20MB / 10MB(可配 1–200) - 传入不在允许列表中的
role会返回asset not allowed for mode错误
计费说明(minimax-h3)
- 输入参考视频时长会累加到计费时长(输入视频按输出视频相同规则计费)
- 计费分辨率按输入参考视频分辨率归一:大于 720p 按
2k计算,小于等于 720p 按720p计算;多个参考视频取最高档
请求示例:全能参考生成视频(ref_media)
{ "model": "minimax-h3", "mode": "ref_media", "prompt": "让参考视频中的角色穿上参考图片中的服装,并跟随参考音频的节奏起舞,保持人物身份一致", "assets": [ { "role": "reference_images", "url": "https://example.com/character.png" }, { "role": "source_video", "url": "https://example.com/dance.mp4", "duration_sec": 8, "resolution": "1080p" }, { "role": "audio", "url": "https://example.com/bgm.mp3", "duration_sec": 10 } ], "resolution": "720p", "duration_sec": 5}请求字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 视频模型 |
mode | string | 是 | 生成模式 |
prompt | string | 条件 | 视频描述;多数模式必填 |
assets | array | 条件 | [{ "role": "...", "url": "https://..." }] |
resolution | string | 否 | 如 720p、1080p |
duration_sec | number | 否 | 时长(秒) |
aspect_ratio | string | 否 | 如 16:9、3:2 |
prompt_optimize | boolean | 否 | 是否开启 prompt 优化 |
gen_tier | string | 否 | 生成档位 |
quality | string | 否 | 画质 |
audio_mode | string | 否 | 音频模式 |
camera_control | string | 否 | 运镜控制 |
shot_type | string | 否 | 镜头类型 |
hd_upscale | string | 否 | 高清放大 |
请求示例:文生视频(t2v)
{ "model": "agnes-video-v2.0", "mode": "t2v", "prompt": "A cinematic shot of a cat walking on the beach at sunset, soft ocean waves, warm golden lighting, realistic motion", "resolution": "720p", "duration_sec": 5, "aspect_ratio": "3:2", "prompt_optimize": false}请求示例:首帧图生视频(first_frame)
{ "model": "agnes-video-v2.0", "mode": "first_frame", "prompt": "The woman slowly turns around and looks back at the camera, natural facial expression, cinematic camera movement", "assets": [ { "role": "first_frame", "url": "https://example.com/image.png" } ], "duration_sec": 5}请求示例:参考图生视频(ref_image)
{ "model": "agnes-video-v2.0", "mode": "ref_image", "prompt": "Create a smooth transformation scene between the two reference images, cinematic lighting, consistent character identity, natural motion", "assets": [ { "role": "reference_images", "url": "https://example.com/image1.png" }, { "role": "reference_images", "url": "https://example.com/image2.png" } ], "duration_sec": 5}请求示例:视频续写(video_extend)
{ "model": "wan2.6-t2v", "mode": "video_extend", "prompt": "Continue the scene with the character walking into the sunset", "assets": [ { "role": "source_video", "url": "https://example.com/source.mp4" } ], "duration_sec": 5, "resolution": "720p"}请求示例(curl)
文生视频(t2v):
curl https://www.yunsell.com/v1/multi/videos \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "model": "agnes-video-v2.0", "mode": "t2v", "prompt": "A cinematic shot of a cat walking on the beach at sunset, soft ocean waves, warm golden lighting, realistic motion", "resolution": "720p", "duration_sec": 5, "aspect_ratio": "3:2", "prompt_optimize": false }'首帧图生视频(first_frame):
curl https://www.yunsell.com/v1/multi/videos \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "model": "agnes-video-v2.0", "mode": "first_frame", "prompt": "The woman slowly turns around and looks back at the camera, natural facial expression, cinematic camera movement", "assets": [ {"role": "first_frame", "url": "https://example.com/image.png"} ], "duration_sec": 5 }'参考图生视频(ref_image):
curl https://www.yunsell.com/v1/multi/videos \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "model": "agnes-video-v2.0", "mode": "ref_image", "prompt": "Create a smooth transformation scene between the two reference images, cinematic lighting, consistent character identity, natural motion", "assets": [ {"role": "reference_images", "url": "https://example.com/image1.png"}, {"role": "reference_images", "url": "https://example.com/image2.png"} ], "duration_sec": 5 }'全能参考生成视频(ref_media):
curl https://www.yunsell.com/v1/multi/videos \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "model": "minimax-h3", "mode": "ref_media", "prompt": "让参考视频中的角色穿上参考图片中的服装,并跟随参考音频的节奏起舞,保持人物身份一致", "assets": [ {"role": "reference_images", "url": "https://example.com/character.png"}, {"role": "source_video", "url": "https://example.com/dance.mp4", "duration_sec": 8, "resolution": "1080p"}, {"role": "audio", "url": "https://example.com/bgm.mp3", "duration_sec": 10} ], "resolution": "720p", "duration_sec": 5 }'视频续写(video_extend):
curl https://www.yunsell.com/v1/multi/videos \ -H "Authorization: Bearer sk-xxx" \ -H "Content-Type: application/json" \ -d '{ "model": "wan2.6-t2v", "mode": "video_extend", "prompt": "Continue the scene with the character walking into the sunset", "assets": [ {"role": "source_video", "url": "https://example.com/source.mp4"} ], "duration_sec": 5, "resolution": "720p" }'响应体
HTTP 200
{ "id": "task_abc123xyz", "status": "queued", "progress": 0, "created_at": 1712697600}响应字段
与 [POST /v1/videos](#4-post-v1videos) 创建任务响应相同。
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,用于后续查询和下载 |
status | string | 初始为 queued |
progress | integer | 进度 0–100 |
created_at | integer | 创建时间 Unix 时间戳(秒) |
后续查询与下载分别使用 GET /v1/videos/{task_id} 和 GET /v1/videos/{task_id}/content,响应字段见 第 5 节 与 第 6 节。
失败响应
HTTP 400
{ "code": "invalid_request", "message": "model and mode are required"}{ "code": "invalid_request", "message": "prompt is required"}错误格式说明见 任务类错误。