| Method | Endpoint | Description |
|---|
| 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
}
}
回调 URL。当 request_type=callback 时必填。(条件必填)
路由策略:auto、value、official 或指定提供商渠道
模型输入参数
text-to-video / image-to-video / turbo-text-to-video / turbo-image-to-video(image 模式通过 image_urls 支持 1 或 2 张图)
仅文字模式风格预设:general 或 anime
仅文字模式宽高比:16:9、9:16、4:3、3:4 或 1:1
参考图 URL。image 模式必填。最多 2 张:1 张为单图动画,2 张为首尾帧生成。(条件必填)
动效强度:auto、small、medium 或 large
是否生成音效(对应上游 generate_audio)
模式说明:
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"
}
}
状态响应字段
当前任务状态:pending、processing、success 或 failed。
包含 resultUrls 数组的 JSON 字符串。仅在成功时存在。使用 JSON.parse() 解析。
错误码。仅当 state 为 failed 时存在。详见错误码。
可读的错误信息。仅当 state 为 failed 时存在。
错误码
| Code | Description |
|---|
| 400 | 参数无效或请求格式错误 |
| 401 | API 密钥缺失或无效 |
| 402 | 余额不足 |
| 429 | 超过速率限制 |
| Fail Code | Description |
|---|
CONTENT_VIOLATION | 请求违反安全准则 |
INVALID_IMAGE_URL | 提供的图片 URL 无法获取 |
速率限制
| Limit | Value |
|---|
| Request rate | 60 requests per minute |
| Concurrent tasks | 10 |
超出限制返回 429 错误。请稍后重试。
视频生成比图像耗时更长 — 生产环境请使用 callback 模式。结果 URL 15 天后失效,请及时下载重要输出。
- 图片数量与模式:
image-to-video 和 turbo-image-to-video 中,image_urls 数量决定流程。1 张为单图动画,2 张为首尾帧转换(第一张为起始帧,第二张为结束帧)。
- 计费:按秒计费,计费秒数等于
duration。分辨率定价见 Pricing。
- 轮询建议:提交任务后等待约 60-90 秒再轮询,之后每隔 5 秒轮询。高并发建议使用
callback 模式。
- 结果 URL 有效期:输出 URL 可能过期,请尽快下载并保存结果。