创建视频生成任务-视频参考
更新时间:2026-02-12
POST
https://qianfan.baidubce.com/beta/video/generations/qianfan-video
创建视频生成任务,返回创建结果。
权限说明
调用本文API,需使用API Key鉴权方式。使用API Key鉴权调用API流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
Body 参数
model
string
模型ID
必选
type
string
生成类型
必选
model_parameters
object {7}
必选
显示子属性
隐藏子属性
prompt
string
提示词
必选
image_list
array
图片列表
可选
显示子属性
隐藏子属性
items
object {2}
显示子属性
隐藏子属性
image_url
string
图片URL
可选
type
string
图片类型,枚举值:first_frame(首帧)、end_frame(尾帧)
可选
element_list
array
元素列表
可选
显示子属性
隐藏子属性
items
object {1}
显示子属性
隐藏子属性
element_id
integer
元素ID
可选
video_list
array
视频列表
可选
显示子属性
隐藏子属性
items
object {3}
显示子属性
隐藏子属性
video_url
string
视频URL
可选
refer_type
string
参考类型,枚举值:feature(特征)、base(基底)
可选
keep_original_sound
string
是否保留原声,枚举值:yes、no
可选
mode
string
生成模式,枚举值:std(标准)、pro(专业)
可选
aspect_ratio
string
宽高比,枚举值:16:9、9:16、1:1
可选
duration
string
视频时长,枚举值:3、4、5、6、7、8、9、10(单位:秒)
可选
请求结构
POST /beta/video/generations/qianfan-video HTTP/1.1
HOST: qianfan.baidubce.com
Authorization: Bearer <API Key>
Content-Type: application/json
{
"model": "KO1",
"type": "omni-video",
"model_parameters": {
"mode": "pro",
"duration": "5",
"prompt": "The camera zooms in on the bird, which then flies to the right. The bird's flight is smooth and natural, with a red light effect following and surrounding it from behind.",
"image_list": [
{
"image_url": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg",
"type": "first_frame"
},
{
"image_url": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg",
"type": "end_frame"
}
]
}
}
示例代码
创建一个视频生成任务
基础调用
curl -X POST "https://qianfan.baidubce.com/beta/video/generations/qianfan-video" \
-H "Authorization: Bearer bce-v3/ALTAK-******ZftZDTn7/125eeb1c5e9ddc8cf3edf18ef6d03f1517ec9408" \
-H "Content-Type: application/json" \
-d '{
"model": "KO1",
"type": "omni-video",
"model_parameters": {
"mode": "pro",
"duration": "5",
"prompt": "The camera zooms in on the bird, which then flies to the right. The bird's flight is smooth and natural, with a red light effect following and surrounding it from behind.",
"image_list": [
{
"image_url": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-1.jpeg",
"type": "first_frame"
},
{
"image_url": "https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/startend2video-2.jpeg",
"type": "end_frame"
}
]
}
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
code
integer
错误码;具体定义见错误码文档
可选
message
string
错误信息
可选
request_id
string
请求ID,系统生成,用于跟踪请求、排查问题
可选
data
object {5}
返回数据体,包含任务相关信息
可选
显示子属性
隐藏子属性
task_id
string
任务ID,系统生成
可选
task_status
string
任务状态,枚举值:submitted(已提交)、processing(处理中)、succeed(成功)、failed(失败)
可选
created_at
integer
任务创建时间,Unix时间戳,单位毫秒
可选
updated_at
integer
任务更新时间,Unix时间戳,单位毫秒
可选
task_info
object {0}
任务额外信息
可选
显示子属性
隐藏子属性
暂无参数
调用成功后返回的任务信息
成功响应
{
"code": 0,
"message": "",
"request_id": "as-xxx",
"data": {
"task_id": "xxx",
"task_status": "submitted",
"created_at": 1766393761000,
"updated_at": 1766393761000,
"task_info": {}
}
}
错误码
如果调用失败并返回报错信息,请参见错误码进行解决。
公共错误码:查看公共错误码
本接口专有错误码如下:
| HTTP状态码 | 错误码 | 错误信息 | 错误描述 |
|---|---|---|---|
| 0 | 请求成功 | - | - |
| 1100 | 账户异常 | 账户异常 | 检查账户配置信息 |
| 1200 | 请求参数非法 | 请求参数非法 | 检查请求参数是否正确 |
| 1201 | 请求参数非法 | 参数非法,如key写错或value非法 | 参考返回体中message字段的具体信息,修改请求参数 |
| 1202 | 请求参数非法 | 请求的method无效 | 查看接口文档,使用正确的request method |
| 1203 | 请求参数非法 | 请求的资源不存在,如模型 | 参考返回体中message字段的具体信息,修改请求参数 |
| 1300 | 触发策略 | 触发平台策略 | 检查是否触发平台策略 |
| 1301 | 触发策略 | 触发平台的内容安全策略 | 检查输入内容,修改后重新发起请求 |
| 5000 | 内部错误 | 服务器内部错误 | 稍后重试,或联系客服 |
| 5001 | 内部错误 | 服务器暂时不可用,通常是在维护 | 稍后重试,或联系客服 |
| 5002 | 内部错误 | 服务器内部超时,通常是发生积压 | 稍后重试,或联系客服 |
视频模型通用错误码
| HTTP状态码 | 错误码 | 错误信息 | 错误描述 |
|---|---|---|---|
| 500 | internal_error | video_genration_interal_error | video generation service interal error |
| 400 | invalid_request_error | invalid_lipsync_argument | |
| 429 | rate_limit_exceeded | video_genration_concurrency_exceeded | Rate limit reached for Concurrency |
| 403 | unsafe_request | video_genration_prompt_unsafe | the content of prompt field is unsafe |
