API 文档AI 模型接口视频Vidu
文生视频
通过文本提示词生成视频。异步任务接口,提交后返回 task_id,需轮询生成物接口获取结果。
通过文本提示词生成视频。支持 viduq3-turbo、viduq3-pro、viduq2、viduq1 等模型,最高 1080p,时长依模型可达 16 秒。
异步任务型接口:提交后立即返回 task_id,需轮询查询生成物接口获取结果。
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
Endpoints
POST /vidu/ent/v2/text2video
创建文生视频任务
通过文本提示词创建视频生成任务。
Request Body
Content-Type: application/json
Example:
{
"model": "viduq3-pro",
"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": "4:3",
"resolution": "540p",
"movement_amplitude": "auto",
"off_peak": false
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 模型名称。可选值:viduq3-turbo、viduq3-pro、viduq2、viduq1。viduq3-turbo 生成更快;viduq3-pro 音视频效果更好;viduq2 最新模型;viduq1 画面清晰、运镜稳定 |
style | string | No | 风格,默认 general。可选:general、anime。使用 q2、q3 系列模型时该参数不生效 |
prompt | string | Yes | 文本提示词,描述期望生成的视频内容。字符长度不能超过 5000 |
duration | integer | No | 视频时长(秒)。viduq3-pro / viduq3-turbo:默认 5,可选 1–16;viduq2:默认 5,可选 1–10;viduq1:默认 5,仅支持 5 |
seed | integer | No | 随机种子。不传或传 0 时使用随机数 |
aspect_ratio | string | No | 画面比例,默认 16:9。可选:16:9、9:16、3:4、4:3、1:1。3:4、4:3 仅支持 q2、q3 系列 |
resolution | string | No | 分辨率。viduq3-pro / viduq3-turbo:默认 720p,可选 540p、720p、1080p;viduq2:默认 720p,可选 540p、720p、1080p;viduq1:默认 1080p,可选 1080p |
movement_amplitude | string | No | 运动幅度,默认 auto。可选:auto、small、medium、large。q2、q3 系列不生效 |
bgm | boolean | No | 是否添加背景音乐,默认 false。q2 模型在 duration 为 9 或 10 秒时不生效;q3 系列不生效 |
audio | boolean | No | 是否音视频直出,默认 true。false 输出静音视频;true 输出含台词与音效的视频。仅 q3 系列支持 |
payload | string | No | 透传参数,最多 1048576 个字符 |
off_peak | boolean | No | 错峰模式,默认 false。true 时积分更低,任务在 48 小时内生成,超时自动取消并退还积分 |
watermark | boolean | No | 是否添加水印,默认不加。可通过查询接口的 watermarked_url 获取带水印结果 |
wm_position | integer | No | 水印位置:1 左上、2 右上、3 右下(默认)、4 左下 |
wm_url | string | No | 自定义水印图片 URL;不传则使用默认水印 |
meta_data | string | No | 元数据标识,JSON 格式字符串,透传字段 |
callback_url | string | No | 任务状态变化时的回调地址(POST)。回调体结构与查询生成物接口一致,状态含 processing、success、failed |
Responses
200: 成功创建任务
Content-Type: application/json
400: 请求参数错误
Content-Type: application/json
429: 请求频率限制
Content-Type: application/json
请求示例
curl -X POST "https://api.autorouter.top/vidu/ent/v2/text2video" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "viduq3-pro",
"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.",
"duration": 5,
"seed": 0,
"aspect_ratio": "4:3",
"resolution": "540p",
"movement_amplitude": "auto",
"off_peak": false
}'响应示例
{
"task_id": "your_task_id_here",
"state": "created",
"model": "viduq3-pro",
"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.",
"duration": 5,
"seed": 123456,
"aspect_ratio": "4:3",
"resolution": "540p",
"movement_amplitude": "auto",
"payload": "",
"off_peak": false,
"credits": 4,
"created_at": "2025-01-01T15:41:31.968916Z"
}响应字段说明:
| Name | Type | Description |
|---|---|---|
task_id | string | 任务 ID,用于查询生成物 |
state | string | 处理状态。枚举:created、queueing、processing、success、failed |
model | string | 本次调用的模型名称 |
prompt | string | 本次调用的提示词 |
duration | integer | 视频时长(秒) |
seed | integer | 随机种子 |
aspect_ratio | string | 画面比例 |
resolution | string | 分辨率 |
bgm | boolean | 是否添加背景音乐 |
movement_amplitude | string | 运动幅度 |
payload | string | 透传参数 |
off_peak | boolean | 是否错峰模式 |
credits | integer | 本次调用消耗的积分数 |
watermark | boolean | 是否添加水印 |
created_at | string | 任务创建时间 |
GET /vidu/ent/v2/tasks/{id}/creations
查询生成物
根据创建任务时返回的 task_id 查询任务状态与生成结果。生成物 URL 有效期 24 小时。详见查询生成物接口。
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | 任务 ID |
请求示例
curl -X GET "https://api.autorouter.top/vidu/ent/v2/tasks/{task_id}/creations" \
-H "Authorization: Bearer sk-xxxxxx"响应示例
{
"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"
}
]
}响应字段说明:
| Name | Type | Description |
|---|---|---|
id | string | 任务 ID |
state | string | 处理状态:created、queueing、processing、success、failed |
err_code | string | 错误码,失败时返回 |
credits | integer | 该任务消耗的积分数 |
payload | string | 透传参数 |
creations | array | 生成物结果列表 |
creations[].id | string | 生成物 ID |
creations[].url | string | 生成物 URL,24 小时有效 |
creations[].cover_url | string | 封面 URL,24 小时有效 |
creations[].watermarked_url | string | 带水印生成物 URL,24 小时有效 |
错误处理
HTTP 400 参数错误(提交前拦截,不扣费)
AutoRouter 在提交到上游前会对必填字段做基础校验:
| 场景 | 响应 |
|---|---|
未传 prompt | {"code":"InvalidParameter","message":"...","request_id":"..."} |
| 未知模型名 | {"code":"InvalidParameter","message":"unknown model: ...","request_id":"..."} |
HTTP 401 / 403 鉴权错误
401 Unauthorized:API Key 无效或已过期403 Forbidden:API Key 无权访问此模型(检查 token 的模型白名单)
HTTP 402 余额不足
返回 insufficient user quota。请前往 AutoRouter 控制台充值。
任务 failed 状态
任务成功提交但上游生成失败(state == "failed"),常见原因见 err_code:
| 原因 | 处理建议 |
|---|---|
| 内容审核失败 | 调整 prompt,避免敏感内容 |
| 参数组合非法(如分辨率不支持) | 按 Request Body 规范传参 |
任务失败时 AutoRouter 会自动退款到你的账户,可在日志页面查询退款记录。