Vidu API
工作台
文档
登录

文生视频

POST https://api.vidu.cn/ent/v2/text2video

请求头

字段描述
Content-Typeapplication/json数据交换格式
AuthorizationToken {your api key}{token} 替换为您的 token

请求体

参数名称类型必填参数描述
modelString模型名称
可选值:viduq1vidu1.5
styleString可选风格
默认 general,可选值:generalanime
general:通用风格,可以通过提示词来控制风格
anime:动漫风格,仅在动漫风格表现突出,可以通过不同的动漫风格提示词来控制
promptString文本提示词
生成视频的文本描述。
注:字符长度不能超过 1500 个字符
durationInt可选视频时长参数,默认值依据模型而定:
- viduq1 : 默认5秒,可选:5
- vidu1.5 : 默认4秒,可选:4、8
seedInt可选随机种子
当默认不传或者传0时,会使用随机数替代
手动设置则使用设置的种子
aspect_ratioString可选比例
默认 16:9,可选值:16:99:161:1
resolutionString可选分辨率参数,默认值依据模型和视频时长而定:
- viduq1 5秒:默认 1080p,可选:1080p
- vidu1.5 4秒:默认 360p,可选:360p、720p、1080p
- vidu1.5 8秒:默认 720p,可选:720p
movement_amplitudeString可选运动幅度
默认 auto,可选值:autosmallmediumlarge
bgmbool可选是否为生成的视频添加背景音乐。
默认:false,可选值 true 、false
- 传 true 时系统将从预设 BGM 库中自动挑选合适的音乐并添加;不传或为 false 则不添加 BGM。
- 仅当最终生成的视频时长为 4秒 时,支持添加 BGM
callback_urlString可选Callback 协议
需要您在创建任务时主动设置 callback_url,请求方法为 POST,当视频生成任务有状态变化时,Vidu 将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致
回调返回的"status"包括以下状态:
- processing 任务处理中
- success 任务完成(如发送失败,回调三次)
- failed 任务失败(如发送失败,回调三次)
curl -X POST -H "Authorization: Token {your_api_key}" -H "Content-Type: application/json" -d '
{
"model": "viduq1",
"style": "general",
"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": "16:9",
"resolution": "1080p",
"movement_amplitude": "auto"
}' https://api.vidu.cn/ent/v2/text2video

响应体

字段类型描述
task_idStringVidu 生成的任务ID
stateString处理状态
可选值:
created 创建成功
queueing 任务排队中
processing 任务处理中
success 任务成功
failed 任务失败
modelString本次调用的模型名称
promptString本次调用的提示词参数
durationInt本次调用的视频时长参数
seedInt本次调用的随机种子参数
aspect_ratioString本次调用的 比例 参数
resolutionString本次调用的分辨率参数
bgmbool本次调用的背景音乐参数
movement_amplitudeString本次调用的镜头动态幅度参数
created_atString任务创建时间
{
"task_id": "your_task_id_here",
"state": "created",
"model": "viduq1",
"style": "general",
"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": "16:9",
"resolution": "1080p",
"movement_amplitude": "auto",
"created_at": "2025-01-01T15:41:31.968916Z"
}