文档 / API 参考 / 生成视频
POST
/v1/video/generations生成视频
提交异步视频生成任务。该调用会立即返回一个 task_id;可通过 查询视频任务 获取结果,或通过 metadata.callback_url 在 webhook 上接收结果。
#请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 视频模型 ID,例如 doubao-seedance-2-0-1080p |
prompt | string | 是 | 文本描述。使用参考图时,用 @image1 到 @imageN 来引用它们 |
seconds | string | 否 | 视频时长(秒),以字符串形式传入(例如 "5"、"10");最大值取决于模型 |
metadata | object | 否 | 厂商参数,详见下文 |
#metadata 字段
| 字段 | 类型 | 说明 |
|---|---|---|
ratio | string | 宽高比,例如 "16:9"、"9:16"、"1:1" |
resolution | string | "480p" | "720p" | "1080p"(取决于模型) |
generate_audio | boolean | 生成配音(Seedance 2.0 系列模型) |
callback_url | string | Webhook 地址;任务完成时会将最终任务状态 POST 到此地址 |
content | array | 参考媒体条目,详见下文 |
#metadata.content[] 条目
content-entry.jsonjson
{
"type": "image_url",
"image_url": { "url": "https://example.com/ref.jpg" },
"role": "reference_image"
}| type | 数据字段 | role | 上限 |
|---|---|---|---|
image_url | image_url.url | reference_image | 每个请求最多 9 个 |
video_url | video_url.url | reference_video | 每个请求最多 3 个 |
audio_url | audio_url.url | reference_audio | 每个请求最多 3 个 |
参考图在 prompt 中按
content[] 的顺序以 @image1 到 @imageN 引用,且与首尾帧模式互斥。callback_url 必须放在 metadata 内,不能放在顶层。#示例:文生视频
terminalbash
curl https://relaydance.com/v1/video/generations \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedance-2-0-1080p",
"prompt": "A timelapse of storm clouds rolling over a mountain range",
"seconds": "10",
"metadata": {
"ratio": "16:9",
"resolution": "1080p",
"generate_audio": true
}
}'#示例:使用参考图
terminalbash
curl https://relaydance.com/v1/video/generations \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-1-5-pro-with-audio",
"prompt": "@image1 rotates slowly on a marble pedestal, studio lighting",
"seconds": "5",
"metadata": {
"ratio": "1:1",
"resolution": "720p",
"content": [
{
"type": "image_url",
"image_url": { "url": "https://example.com/product.jpg" },
"role": "reference_image"
}
]
}
}'#响应
response.jsonjson
{
"task_id": "task_abc123",
"status": "submitted"
}失败的任务不计费。模型 ID 列在 视频生成 页面,也可通过
GET /v1/models 获取。