控制台
视频生成 / Vidu

Vidu Q4 Preview 视频生成

概述

Vidu Q4 Preview 支持图生视频(i2v)与参考生视频(r2v),视频时长 3-16 秒,分辨率最高 4K,可生成带音效的视频。

文生视频(t2v)暂不支持,请使用图生视频或参考生视频。

Base URL: https://mm-internal-cn.leonecloud.com


认证方式

Authorization: Bearer {YOUR_AUTH_TOKEN}

快速开始

创建图生视频任务

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/vidu-q4-preview" \
  -H "Authorization: Bearer your_auth_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "让图片中的人物缓缓转头微笑",
    "genType": "i2v",
    "imageUrls": ["https://example.com/reference.jpg"],
    "resolution": "720p",
    "duration": 5
  }'

创建参考生视频任务

curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/vidu-q4-preview" \
  -H "Authorization: Bearer your_auth_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "画面中的角色在樱花树下并肩走过,镜头缓慢跟随",
    "genType": "r2v",
    "imageUrls": [
      "https://example.com/character.jpg",
      "https://example.com/scene.jpg"
    ],
    "resolution": "1080p",
    "aspectRatio": "16:9",
    "duration": 8
  }'

查询任务状态

curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/aigc/task_abc123" \
  -H "Authorization: Bearer your_auth_token_here"

创建任务

POST /api/v2/open/aigc/vidu-q4-preview

Content-Type: application/json

请求参数

参数类型必填说明
genTypestring否生成类型:i2v 图生视频 / r2v 参考生视频。不传时按素材自动判定(多于 1 张图或带 sounds 按 r2v;否则按 i2v)。t2v 文生视频暂不支持
promptstring条件提示词,最多 20000 字符。r2v 必填,i2v 可选
imageUrlsstring[]是图片素材。i2v 恰好 1 张;r2v 1-15 张
soundsstring[]否参考音频,仅 r2v 支持,最多 3 段,每段时长 3-12 秒
resolutionstring否分辨率:540p / 720p(默认) / 1080p / 2K / 4K
durationint否视频时长(秒),默认 5,范围 3-16
aspectRatiostring否宽高比,仅 r2v 支持:16:9(默认) / 9:16 / 1:1 / 4:3 / 3:4
audiobool否是否同时生成音频,不传按服务默认值
isRecbool否是否对提示词做智能改写,仅 i2v 支持,不传按服务默认值
seedint否随机种子,取值 [0, 2147483647]。不传或传 0 表示随机
watermarkbool否是否添加水印,不传按服务默认值
wmPositionint否水印位置:1 左上 / 2 右上 / 3 右下 / 4 左下
wmUrlstring否自定义水印图片 URL
payloadstring否透传字段,最多 1048576 字符,原样回显
taskNicknamestring否任务昵称,便于在任务列表中识别
callbackUrlstring否任务完成后的回调通知URL

支持的 genType

genType说明imageUrls 要求prompt可用参数
i2v图生视频恰好 1 张可选isRec
r2v参考生视频1-15 张必填sounds、aspectRatio
注意:两种类型的参数互斥,传错会直接返回参数错误而不会被静默忽略:
- i2v 不接受 sounds 与 aspectRatio,且 imageUrls 只能 1 张;
- r2v 不接受 isRec。

传 genType=t2v 或不带任何 imageUrls 会返回参数错误(文生视频暂不支持),任务不会创建、不会产生费用。

resolution 直接决定计费单价,传入不在白名单内的值会返回参数错误,不会自动回落到默认档。

请求示例

图生视频(540p / 3 秒):

{
  "prompt": "镜头缓慢推进,人物睁开眼睛",
  "genType": "i2v",
  "imageUrls": ["https://example.com/portrait.jpg"],
  "resolution": "540p",
  "duration": 3,
  "isRec": true
}

参考生视频(带参考音频):

{
  "prompt": "两位角色在雨中对话,氛围安静",
  "genType": "r2v",
  "imageUrls": [
    "https://example.com/char-a.jpg",
    "https://example.com/char-b.jpg",
    "https://example.com/street.jpg"
  ],
  "sounds": ["https://example.com/rain.mp3"],
  "resolution": "1080p",
  "aspectRatio": "9:16",
  "duration": 8,
  "audio": true
}

4K 高分辨率:

{
  "prompt": "航拍雪山,云海翻涌",
  "genType": "i2v",
  "imageUrls": ["https://example.com/mountain.jpg"],
  "resolution": "4K",
  "duration": 5
}

响应示例

{
  "code": 0,
  "msg": "success",
  "data": {
    "taskId": "task_20260507103000_abc12345",
    "status": "processing",
    "createdAt": "2026-05-07 10:30:00"
  }
}

计费说明

按「分辨率档单价 × 视频时长(秒)」计费,时长以请求中的 duration 为准。

任务创建时按上述金额预冻结,仅在生成成功时扣费;生成失败全额解冻退回。


查询任务状态

GET /api/v2/open/aigc/{taskId}

响应参数

参数类型说明
codeint状态码,0 表示成功
msgstring状态信息
data.taskIdstring任务 ID
data.statusstringprocessing / success / failed
data.resultstring[]生成的视频 URL 列表(成功时返回)
data.errorMsgstring错误信息(失败时返回)
data.createdAtstring创建时间
data.updatedAtstring更新时间
结果链接有效期 24 小时:data.result 中的视频链接为限时直链,自生成后 24 小时失效,超时后访问会返回鉴权错误。请在获取链接后尽快下载并转存至自有永久存储。

响应示例

{
  "code": 0,
  "msg": "success",
  "data": {
    "taskId": "task_20260507103000_abc12345",
    "status": "success",
    "result": [
      "https://example-video-store.s3.amazonaws.com/tasks/2026/05/07/video.mp4?X-Amz-Expires=86400&X-Amz-Signature=xxx"
    ],
    "createdAt": "2026-05-07 10:30:00",
    "updatedAt": "2026-05-07 10:32:30"
  }
}

批量查询任务状态

POST /api/v2/open/aigc/batch

{
  "taskIds": ["task_20260507103000_abc12345", "task_20260507103200_def67890"]
}

回调通知

当任务完成时,如果提供了 callbackUrl,系统会发送 POST 请求:

{
  "event": "task.completed",
  "taskId": "task_20260507103000_abc12345",
  "status": "success",
  "result": ["https://example-video-store.s3.amazonaws.com/tasks/video.mp4?X-Amz-Expires=86400&X-Amz-Signature=xxx"],
  "errorMsg": "",
  "timestamp": "2026-05-07T10:32:30+08:00"
}

错误码

code说明
0成功
10002参数缺失或格式错误
10005API Key 无效或缺失
10007余额不足
30003任务不存在
90003服务器内部错误
更新于 2026-10-10