API 文档AI 模型接口视频Vidu
图生视频
以首帧图为起点按提示词生成视频。异步任务接口,提交后返回 task_id,需轮询生成物接口获取结果。
以一张首帧图为起点,按提示词生成后续动作视频。支持 viduq3-pro、viduq3-turbo、viduq2-pro、viduq1 等模型,最高 1080p。
异步任务型接口:提交后立即返回 task_id,需轮询查询生成物接口获取结果。
Base URL
https://api.autorouter.top— Production
Authentication
BearerAuth: http (bearer)
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
Endpoints
POST /vidu/ent/v2/img2video
创建图生视频任务
以首帧图为起点创建视频生成任务。
Request Body
Content-Type: application/json
Example:
{
"model": "viduq3-pro",
"images": ["https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/image2video.png"],
"prompt": "The astronaut waved and the camera moved up.",
"audio": true,
"voice_id": "professional_host",
"duration": 5,
"seed": 0,
"resolution": "1080p",
"movement_amplitude": "auto",
"off_peak": false
}Properties:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | 模型名称。可选值:viduq3-turbo、viduq3-pro、viduq3-pro-fast、viduq2-pro-fast、viduq2-pro、viduq2-turbo、viduq1、viduq1-classic、vidu2.0 |
images | string[] | Yes | 首帧图像,仅支持 1 张。支持图片 URL 或 Base64(需含 data:image/png;base64,... 前缀)。格式:png / jpeg / jpg / webp;比例小于 1:4 或 4:1;大小 ≤ 50 MB;请求体 ≤ 20 MB |
prompt | string | No | 文本提示词,不超过 5000 字符。启用 is_rec 时忽略此字段 |
audio | boolean | No | 是否音视频直出。默认 false;q3-pro / q3-turbo / q3-pro-fast 默认 true。为 true 时 voice_id 才生效 |
audio_type | string | No | 音频类型,audio 为 true 时必填,默认 all。可选:all、speech_only、sound_effect_only。目前仅 q2 / q1 / 2.0 系列支持音频拆分 |
voice_id | string | No | 音色 ID,q3 系列不生效。为空时系统自动推荐 |
is_rec | boolean | No | 是否使用推荐提示词。true 时由系统推荐,每个任务额外消耗 10 积分 |
bgm | boolean | No | 是否添加背景音乐,默认 false。q2 在 duration 为 9 或 10 秒时不生效;q3 不生效 |
duration | integer | No | 视频时长(秒)。q3 系列默认 5,可选 1–16;q2 系列默认 5,可选 1–10;viduq1 / viduq1-classic 仅 5;vidu2.0 默认 4,可选 4、8 |
seed | integer | No | 随机种子。不传或传 0 时使用随机数 |
resolution | string | No | 分辨率,默认值依模型与时长而定。常见可选:360p、540p、720p、1080p |
movement_amplitude | string | No | 运动幅度,默认 auto。可选:auto、small、medium、large。q2、q3 系列不生效 |
payload | string | No | 透传参数,最多 1048576 个字符 |
off_peak | boolean | No | 错峰模式,默认 false。除 q3 外的其他音视频直出功能不支持错峰 |
watermark | boolean | No | 是否添加水印,默认不加 |
wm_position | integer | No | 水印位置:1 左上、2 右上、3 右下(默认)、4 左下 |
wm_url | string | No | 自定义水印图片 URL |
meta_data | string | No | 元数据标识,JSON 格式字符串 |
callback_url | string | No | 任务状态变化时的回调地址(POST) |
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/img2video" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxx" \
-d '{
"model": "viduq3-pro",
"images": ["https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/image2video.png"],
"prompt": "The astronaut waved and the camera moved up.",
"audio": true,
"duration": 5,
"seed": 0,
"resolution": "1080p",
"movement_amplitude": "auto",
"off_peak": false
}'响应示例
{
"task_id": "your_task_id_here",
"state": "created",
"model": "viduq3-pro",
"images": ["https://prod-ss-images.s3.cn-northwest-1.amazonaws.com.cn/vidu-maas/template/image2video.png"],
"prompt": "The astronaut waved and the camera moved up.",
"duration": 5,
"seed": 123456,
"resolution": "1080p",
"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 | 本次调用的模型名称 |
images | string[] | 本次调用的图像参数 |
prompt | string | 本次调用的提示词 |
duration | integer | 视频时长(秒) |
audio | boolean | 是否音画同出 |
audio_type | string | 输出音频类型 |
seed | integer | 随机种子 |
resolution | string | 分辨率 |
movement_amplitude | string | 运动幅度 |
payload | string | 透传参数 |
off_peak | boolean | 是否错峰模式 |
credits | integer | 消耗积分数 |
watermark | boolean | 是否添加水印 |
created_at | string | 任务创建时间 |
GET /vidu/ent/v2/tasks/{id}/creations
查询生成物
根据 task_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"
}
]
}错误处理
HTTP 400 参数错误(提交前拦截,不扣费)
| 场景 | 响应 |
|---|---|
未传 images | {"code":"InvalidParameter","message":"...","request_id":"..."} |
| 未知模型名 | {"code":"InvalidParameter","message":"unknown model: ...","request_id":"..."} |
HTTP 401 / 403 鉴权错误
401 Unauthorized:API Key 无效或已过期403 Forbidden:API Key 无权访问此模型
HTTP 402 余额不足
返回 insufficient user quota。请前往 AutoRouter 控制台充值。
任务 failed 状态
任务失败时见 err_code。失败时 AutoRouter 会自动退款。