Wan 2.6 异步视频生成
API 文档
使用这些端点提交 Wan 2.6 任务并检查其状态。每次调用都会根据时长和音频(同步对话、音效、音乐)消耗积分。
身份验证
所有请求必须在 Authorization header:
Authorization: Bearer <YOUR_API_KEY>缺少或无效的密钥将返回 401 Unauthorized.
POST
https://wan26ai.app/api/generate
创建生成任务
提交一个新的 Wan 2.6 任务。调用会立即返回一个 task_id,同时渲染异步完成。
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| model | string | 是 | 模型 ID:wan/2-6-text-to-video、wan/2-6-image-to-video 或 wan/2-6-video-to-video。 |
| prompt | string (max 5000 chars) | 是 | 场景描述(最多 5000 字符)。 |
| duration | string | 否 | 视频时长:"5"、"10" 或 "15"(视频转视频仅支持 5 或 10)。 |
| resolution | string | 否 | 输出分辨率:"720p" 或 "1080p"。默认:1080p。 |
| image_urls | string[] | 否 | 参考图片 URL(图片转视频模型必需)。 |
| video_urls | string[] | 否 | 源视频 URL(视频转视频模型必需)。 |
| callback_url | string | 否 | 可选的 Webhook URL,用于任务完成通知。 |
| public | boolean | 否 | 将任务公开到公共画廊。 |
积分消耗
积分在任务创建时扣除。失败的任务将自动退款。
| 预设 | 扣除积分 |
|---|---|
| 720p × 5s | 80 |
| 720p × 10s | 150 |
| 720p × 15s | 220 |
| 1080p × 5s | 115 |
| 1080p × 10s | 220 |
| 1080p × 15s | 325 |
请求示例
{
"model": "wan/2-6-text-to-video",
"prompt": "A golden retriever running through a sunlit meadow, slow motion, cinematic",
"duration": "5",
"resolution": "1080p"
}
// Image-to-Video example:
{
"model": "wan/2-6-image-to-video",
"prompt": "Add gentle wind motion to the scene",
"duration": "5",
"resolution": "720p",
"image_urls": ["https://example.com/reference.jpg"]
}
// Video-to-Video example:
{
"model": "wan/2-6-video-to-video",
"prompt": "Transform to anime style",
"duration": "5",
"resolution": "720p",
"video_urls": ["https://example.com/source.mp4"]
}响应示例
{
"code": 200,
"message": "success",
"data": {
"task_id": "n35abc123def456wan26",
"status": "IN_PROGRESS"
}
}GET / POST
https://wan26ai.app/api/status
检查任务状态
使用此端点来轮询最新的记录。当任务仍处于 IN_PROGRESS(进行中)状态时,我们在回复之前会再次查询提供者。
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| task_id | string | 是 | 由 /generate 返回的 ID。通过查询参数 (?task_id=) 或 JSON 正文发送。 |
| 字段 | 描述 |
|---|---|
| task_id | 从 /generate 返回的 ID。 |
| status | SUCCESS(成功) |
| request | 已清理的用户提交有效负载副本。 |
| response | 当 status 为 SUCCESS 时返回的媒体 URL 数组。 |
| consumed_credits | 任务消耗的积分(退款时为 0)。 |
| error_message | 当 status 为 FAILED 时返回的提供者错误信息。 |
| created_at | 任务存储时的 UTC 时间戳。 |
请求示例
GET https://wan26ai.app/api/status?task_id=n35abc123def456wan26
Authorization: Bearer <YOUR_API_KEY>
# or POST
POST https://wan26ai.app/api/status
Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json
{
"task_id": "n35abc123def456wan26"
}响应示例
{
"code": 200,
"message": "success",
"data": {
"task_id": "n35abc123def456wan26",
"status": "SUCCESS",
"request": {
"model": "wan/2-6-text-to-video",
"prompt": "A golden retriever running through a sunlit meadow",
"duration": "5",
"resolution": "1080p"
},
"response": [
"https://static.gogloai.com/wan26/video_001.mp4"
],
"consumed_credits": 115,
"error_message": null,
"created_at": "2025-12-17T10:30:00Z"
}
}错误处理
401 Unauthorized- API 密钥缺失或无效。402 Payment Required- 积分余额不足以支付扣除的费用。429 Too Many Requests- 减少轮询频率或请求速率。500- 暂时性问题;请使用指数退避策略重试。