Vidu Q2 图片/视频生成

查看 Markdown 原文

概述

Vidu Q2 均衡版,支持文生图(t2i)、文生视频(t2v)、图生视频(i2v)、多图生视频(mi2v),视频时长 1-10 秒。

Base URL: https://api.apiverse.ai


认证方式

Authorization: Bearer {YOUR_AUTH_TOKEN}

快速开始

创建文生视频任务

curl -X POST "https://api.apiverse.ai/api/v2/open/aigc/vidu-q2" \
  -H "Authorization: Bearer your_auth_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "一只猫在阳光下慵懒地伸展身体",
    "genType": "t2v",
    "resolution": "1080P",
    "aspectRatio": "16:9",
    "duration": 5
  }'

创建文生图任务

curl -X POST "https://api.apiverse.ai/api/v2/open/aigc/vidu-q2" \
  -H "Authorization: Bearer your_auth_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "一朵绽放的红色玫瑰花,微距摄影",
    "genType": "t2i",
    "resolution": "2K",
    "aspectRatio": "1:1"
  }'

查询任务状态

curl -X GET "https://api.apiverse.ai/api/v2/open/aigc/task_abc123" \
  -H "Authorization: Bearer your_auth_token_here"

创建任务

POST /api/v2/open/aigc/vidu-q2

Content-Type: application/json

请求参数

参数类型必填说明
promptstring提示词,最多1500字符
genTypestring生成类型,默认 t2i
imageUrlsstring[]条件参考图片URL(i2v: 1张, mi2v: 最多7张)
base64FilestringBase64编码的图片(替代imageUrls)
base64FileListstring[]Base64编码的多张图片
resolutionstring分辨率:720P / 1080P(默认) / 2K / 4K
aspectRatiostring宽高比:16:9(默认) / 9:16 / 1:1 / 4:3 / 3:4
durationint视频时长(秒),默认5,范围 1-10
callbackUrlstring任务完成后的回调通知URL

支持的 genType

genType说明imageUrls 要求
t2i文生图不需要
t2v文生视频不需要
i2v图生视频1张图片
mi2v多图生视频1-7张图片
说明:图片生成(t2i)不需要 duration 参数

请求示例

文生图(2K分辨率):

{
  "prompt": "一朵绽放的红色玫瑰花,微距摄影风格",
  "genType": "t2i",
  "resolution": "2K",
  "aspectRatio": "1:1"
}

文生视频(5秒):

{
  "prompt": "无人机航拍,城市日落,金色光芒洒满高楼",
  "genType": "t2v",
  "resolution": "1080P",
  "aspectRatio": "16:9",
  "duration": 5
}

图生视频:

{
  "prompt": "让图片中的花朵随风摇曳",
  "genType": "i2v",
  "imageUrls": ["https://example.com/flower.jpg"],
  "resolution": "1080P",
  "duration": 5
}

多图生视频:

{
  "prompt": "将这些图片组合成一段连贯的视频",
  "genType": "mi2v",
  "imageUrls": [
    "https://example.com/img1.jpg",
    "https://example.com/img2.jpg",
    "https://example.com/img3.jpg"
  ],
  "resolution": "1080P",
  "duration": 6
}

响应参数

参数类型说明
codeint状态码,0 表示成功
msgstring状态信息
data.taskIdstring任务 ID
data.statusstring固定为 processing
data.createdAtstring创建时间

响应示例

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

查询任务状态

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更新时间

响应示例

成功

{
  "code": 0,
  "msg": "success",
  "data": {
    "taskId": "task_20260507103000_abc12345",
    "status": "success",
    "result": [
      "https://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/2026/05/07/output_001.mp4"
    ],
    "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://fc-gw-sh.oss-accelerate.aliyuncs.com/videos/output_001.mp4"],
  "errorMsg": "",
  "timestamp": "2026-05-07T10:32:30+08:00"
}

错误码

code说明
0成功
10002参数缺失或格式错误
10005API Key 无效或缺失
30003任务不存在
90003服务器内部错误