创建任务
POST
/ent/v2/text2video查询生成物
GET
/ent/v2/tasks/{id}/creationsVidu Q-视频模型
Authorizationstring*将 {your api key} 替换为您的 token
Token {your api key}modelstring*模型名称,可选值:viduq2
promptstring*文本提示词
生成视频的文本描述。
注:字符长度不能超过 5000 个字符
durationinteger视频时长参数,默认值依据模型而定:
seedinteger随机种子
当默认不传或者传0时,会使用随机数替代
手动设置则使用设置的种子
aspect_ratiostring比例
默认 16:9,可选值:16:9、9:16、3:4、4:3、1:1
resolutionstring分辨率参数,默认值依据模型和视频时长而定:
audioboolean是否使用音视频直出能力,默认为true,枚举值为:
payloadstring透传参数
不做任何处理,仅数据传输
注:最多 1048576个字符
off_peakbooleanwatermarkboolean是否添加水印
wm_positioninteger水印位置,表示水印出现在图片的位置,可选项为:
1:右下角
2:左下角
3:右上角
4:左上角
默认为:1
wm_urlstring水印内容,此处为图片URL
不传时,使用默认水印:内容由AI生成
meta_datastring元数据标识,json格式字符串,透传字段,您可以 自定义格式 或使用 示例格式 ,示例如下:
{
"Label": "your_label","ContentProducer": "yourcontentproducer","ContentPropagator": "your_content_propagator","ProduceID": "yourproductid", "PropagateID": "your_propagate_id","ReservedCode1": "yourreservedcode1", "ReservedCode2": "your_reserved_code2"
}
该参数为空时,默认使用vidu生成的元数据标识
callback_urlstringCallback 协议
需要您在创建任务时主动设置 callback_url,请求方法为 POST,当视频生成任务有状态变化时,Vidu 将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致
回调返回的"status"包括以下状态:
Authorizationstring*将 {your api key} 替换为您的 token
Token {your api key}idstring*任务id,由创建任务接口创建成功返回
curl --request POST \
--url 'https://api.vidu.cn/ent/v2/text2video' \
--header 'Authorization: Token {your api key}' \
--header 'Content-Type: application/json' \
--data '{
"model": "viduq2",
"prompt": "In an ultra-realistic fashion photography style featuring light blue and pale amber tones, an astronaut in a spacesuit walks through the fog. The background consists of enchanting white and golden lights, creating a minimalist still life and an impressive panoramic scene.",
"duration": 5,
"seed": 0,
"aspect_ratio": "4:3",
"resolution": "540p",
"audio": true,
"payload": "string",
"off_peak": false,
"watermark": true,
"wm_position": 0,
"wm_url": "string",
"meta_data": "string",
"callback_url": "string"
}' {
"task_id": "your_task_id_here",
"state": "created",
"model": "viduq2",
"prompt": "In an ultra-realistic fashion photography style featuring light blue and pale amber tones, an astronaut in a spacesuit walks through the fog. The background consists of enchanting white and golden lights, creating a minimalist still life and an impressive panoramic scene.",
"duration": 5,
"seed": random_number,
"aspect_ratio": "4:3",
"resolution": "540p",
"movement_amplitude": "auto",
"payload":"",
"off_peak": false,
"credits": credits_number,
"created_at": "2025-01-01T15:41:31.968916Z"
}curl --request GET \
--url 'https://api.vidu.cn/ent/v2/tasks/{your_id}/creations' \
--header 'Authorization: Token {your api key}'{
"id":"your_task_id",
"state": "success",
"err_code": "",
"credits": 4,
"payload": "",
"creations": [
{
"id": "your_creations_id",
"url": "your_generated_results_url",
"cover_url": "your_generated_results_cover_url",
"watermarked_url": "your_generated_results_watermarked_url"
}
]
}application/json返回参数
task_idstringVidu 生成的任务ID
statestring处理状态
可选值:
created 创建成功
queueing 任务排队中
processing 任务处理中
success 任务成功
failed 任务失败
modelstring本次调用的模型名称
promptstring本次调用的提示词参数
durationapplication/json返回参数
idstring任务ID
statestring处理状态
可选值:
created 创建成功
queueing 任务排队中
processing 任务处理中
success 任务成功
failed 任务失败
err_codestring错误码,具体见错误码表
creditsinteger该任务消耗的积分数量,单位:积分
payloadstring本次任务调用时传入的透传参数
bgmboolean本次任务调用是否使用bgm
off_peakboolean本次任务调用是否使用错峰模式
creationsarray生成物结果
idstring生成物id,用来标识不同的生成物
urlstring生成物URL, 24小时有效期
cover_urlstring生成物封面,24小时有效期
watermarked_urlstring带水印的生成物url,24小时有效期
本次调用的视频时长参数
seedinteger本次调用的随机种子参数
aspect_ratiostring本次调用的 比例 参数
resolutionstring本次调用的分辨率参数
bgmboolean本次调用的背景音乐参数
movement_amplitudestring本次调用的镜头动态幅度参数
payloadstring本次调用时传入的透传参数
off_peakboolean本次调用时是否使用错峰模式
creditsinteger本次调用使用的积分数
watermarkboolean本次提交任务是否使用水印
created_atstring任务创建时间