跳转到主要内容

接口

MethodEndpointDescription
POST/api/v1/generateTask/vidu-q3创建生成任务
GET/api/v1/statusTask/vidu-q3查询任务状态

认证

所有请求需在请求头中携带 API 密钥:
Authorization: Bearer YOUR_API_KEY

请求体

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-video",
    "prompt": "a cinematic shot of a futuristic city at sunrise",
    "resolution": "720p",
    "duration": 8,
    "style": "general",
    "aspect_ratio": "4:3",
    "movement": "auto",
    "sound": true,
    "bgm": true,
    "seed": 1234
  }
}

参数

request_type
string
默认值:"async"
执行模式:async(轮询)或 callback
callback_url
string
回调 URL。当 request_type=callback 时必填。(条件必填)
provider
string
默认值:"auto"
路由策略:autovalueofficial 或指定提供商渠道
input
object
必填
模型输入参数
模式说明:
  • text-to-video - 纯文字生成视频
  • image-to-video - 从 1 或 2 张图生成视频
  • turbo-text-to-video - Turbo 文生视频
  • turbo-image-to-video - Turbo 图生视频,支持 1 或 2 张图

示例

文生视频(text-to-video)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/vidu-q3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-video",
      "prompt": "a cinematic flyover of a futuristic city at sunrise",
      "resolution": "720p",
      "duration": 8,
      "style": "general",
      "aspect_ratio": "16:9",
      "movement": "auto",
      "sound": true,
      "bgm": true
    }
  }'
单图动画(image-to-video,1 张图)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/vidu-q3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "input": {
      "mode": "image-to-video",
      "prompt": "make this image come alive with subtle motion",
      "resolution": "1080p",
      "duration": 4,
      "image_urls": [
        "https://example.com/start.jpg"
      ]
    }
  }'
首尾帧生成(image-to-video,2 张图)
curl -X POST "https://api.apixo.ai/api/v1/generateTask/vidu-q3" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-video",
      "prompt": "transition from start to end smoothly",
      "resolution": "720p",
      "duration": 8,
      "image_urls": [
        "https://example.com/start.jpg",
        "https://example.com/end.jpg"
      ]
    }
  }'

响应

POST /api/v1/generateTask/vidu-q3

成功时返回 taskId,用于后续查询任务状态。 成功:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
失败:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/vidu-q3

通过 taskId 查询执行状态与最终结果。
curl -X GET "https://api.apixo.ai/api/v1/statusTask/vidu-q3?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
成功:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965730929,
    "costTime": 120000
  }
}
失败:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

状态响应字段

taskId
string
任务唯一标识。
state
string
当前任务状态:pendingprocessingsuccessfailed
resultJson
string
包含 resultUrls 数组的 JSON 字符串。仅在成功时存在。使用 JSON.parse() 解析。
failCode
string
错误码。仅当 statefailed 时存在。详见错误码
failMsg
string
可读的错误信息。仅当 statefailed 时存在。
createTime
integer
任务创建时间戳(Unix 毫秒)。
completeTime
integer
任务完成时间戳(Unix 毫秒)。
costTime
integer
处理耗时(毫秒)。

错误码

CodeDescription
400参数无效或请求格式错误
401API 密钥缺失或无效
402余额不足
429超过速率限制
Fail CodeDescription
CONTENT_VIOLATION请求违反安全准则
INVALID_IMAGE_URL提供的图片 URL 无法获取

速率限制

LimitValue
Request rate60 requests per minute
Concurrent tasks10
超出限制返回 429 错误。请稍后重试。
视频生成比图像耗时更长 — 生产环境请使用 callback 模式。结果 URL 15 天后失效,请及时下载重要输出。

提示

  • 图片数量与模式image-to-videoturbo-image-to-video 中,image_urls 数量决定流程。1 张为单图动画,2 张为首尾帧转换(第一张为起始帧,第二张为结束帧)。
  • 计费:按秒计费,计费秒数等于 duration。分辨率定价见 Pricing
  • 轮询建议:提交任务后等待约 60-90 秒再轮询,之后每隔 5 秒轮询。高并发建议使用 callback 模式。
  • 结果 URL 有效期:输出 URL 可能过期,请尽快下载并保存结果。