创建视频任务
通过参考图片、视频、音频等多模态素材,结合提示词生成全新视频。
接口信息
接口:POST https://api-ai.xku.com/doubao/v3/contents/generations/tasks
请求参数
| 参数 | 说明 | 必填 |
|---|---|---|
model | 模型 ID | 是 |
content | 多模态内容数组,包含提示词和参考素材 | 是 |
generate_audio | true:输出视频包含同步音频;false:输出视频为无声视频 | 否 |
ratio | 视频比例:16:9、4:3、1:1、3:4、9:16、21:9、adaptive | 否 |
duration | 视频时长,默认 5 秒,范围 4~15 秒 | 否 |
watermark | true:含水印;false:不含水印 | 否 |
resolution | 视频分辨率:480p、720p、1080p,默认 720p | 否 |
模型列表
| 模型名称 | 支持的分辨率 |
|---|---|
doubao-seedance-2-0-260128 | 480p、720p、1080p |
doubao-seedance-2-0-fast-260128 | 480p、720p |
doubao-seedance-2-0-mini-260615 | 480p、720p |
content 数组说明
文本(提示词)
| 字段 | 说明 |
|---|---|
type | 固定值 "text" |
text | 提示词内容,描述要生成的视频内容 |
参考图片
| 字段 | 说明 |
|---|---|
type | 固定值 "image_url" |
image_url.url | 图片地址,支持公网 URL 或素材 ID(asset:// + 素材ID) |
role | "reference_image"(参考图片)或 "first_frame"(首帧)或 "last_frame"(尾帧) |
图片要求:
- 数量:1-9 张
- 格式:jpeg、png、webp、bmp、tiff、gif
- 宽高比:(0.4, 2.5)
- 宽高长度:300-6000 px
参考视频
| 字段 | 说明 |
|---|---|
type | 固定值 "video_url" |
video_url.url | 视频地址,支持公网 URL 或素材 ID |
role | "reference_video" |
视频要求:
- 分辨率:480p、720p
- 时长:单个视频 2~15 秒,最多 3 个,总时长 ≤ 15 秒
- 宽高比:[0.4, 2.5]
- 宽高长度:300-6000 px
参考音频
| 字段 | 说明 |
|---|---|
type | 固定值 "audio_url" |
audio_url.url | 音频地址,支持公网 URL 或素材 ID |
role | "reference_audio" |
音频要求:
- 格式:wav、mp3
- 时长:单个音频 2~15 秒,最多 3 段,总时长 ≤ 15 秒
- 大小:单个 ≤ 15 MB
使用示例
文生视频
bash
curl --location --request POST 'https://api-ai.xku.com/doubao/v3/contents/generations/tasks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "一只可爱的小猫在草地上奔跑,阳光明媚,风景优美"
}
],
"generate_audio": true,
"ratio": "16:9",
"duration": 5,
"watermark": false
}'图生视频 - 首帧
bash
curl --location --request POST 'https://api-ai.xku.com/doubao/v3/contents/generations/tasks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "女孩抱着狐狸,女孩睁开眼,温柔地看向镜头,狐狸友善地抱着,镜头缓缓拉出,女孩的头发被风吹动,可以听到风声"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first-frame.png"
},
"role": "first_frame"
}
],
"generate_audio": true,
"ratio": "adaptive",
"duration": 5,
"watermark": false
}'图生视频 - 首尾帧
bash
curl --location --request POST 'https://api-ai.xku.com/doubao/v3/contents/generations/tasks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "图中女孩对着镜头说茄子,360度环绕运镜"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/first-frame.jpeg"
},
"role": "first_frame"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/last-frame.jpeg"
},
"role": "last_frame"
}
],
"generate_audio": true,
"ratio": "adaptive",
"duration": 5,
"watermark": false
}'多模态视频生成
bash
curl --location --request POST 'https://api-ai.xku.com/doubao/v3/contents/generations/tasks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "全程使用视频1的第一视角构图,全程使用音频1作为背景音乐"
},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image1.jpg"
},
"role": "reference_image"
},
{
"type": "video_url",
"video_url": {
"url": "https://example.com/video1.mp4"
},
"role": "reference_video"
},
{
"type": "audio_url",
"audio_url": {
"url": "https://example.com/audio1.mp3"
},
"role": "reference_audio"
}
],
"generate_audio": true,
"ratio": "16:9",
"duration": 11,
"watermark": false
}'返回示例
json
{
"id": "doubao.cgt-20250101000000-0000",
"model": "doubao-seedance-2-0-260128",
"status": "queued",
"created_at": 1743414619
}注意事项
- 视频生成任务为异步任务,需通过查询接口获取最终结果
- 素材会不定期删除,请勿将素材接口作为长期存储服务
- 使用素材 ID 时,格式为
asset://+ 素材 ID - fast、mini 模型不支持 1080p 分辨率