Wan 2.6
Wan 2.6 is Alibaba's video generation model. It supports text-to-video, image-to-video from one first-frame image, and reference-to-video with reference images or videos. Output can be 720p or 1080p.
Models
| Model Name | Mode |
|---|---|
wan-2.6-text-to-video | Text-to-video |
wan-2.6-image-to-video | Image-to-video from one first-frame image |
wan-2.6-reference-to-video | Reference-to-video with reference images and videos |
Pricing
Billed per second x resolution, matching Wan 2.7 pricing:
| Resolution | Credits/sec |
|---|---|
720p | 24 |
1080p | 40 |
Create Task
POST https://api.aivideoapi.ai/v1/videos/generations
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | One of the model names above |
input | object | Yes | Generation parameters |
callback_url | string | No | URL to receive task completion/failure notifications |
Common Input
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt, max 1500 characters |
negative_prompt | string | No | Negative prompt, max 500 characters |
resolution | string | No | 720p or 1080p; default 1080p |
shot_type | string | No | single or multi; default single. multi requires prompt_extend to be true. |
prompt_extend | boolean | No | Enable prompt rewriting, default true |
watermark | boolean | No | Add a watermark, default false |
seed | integer | No | Integer between 0 and 2147483647 |
Text-to-Video Input
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt |
aspect_ratio | string | No | 16:9, 9:16, 1:1, 4:3, or 3:4; default 16:9 |
duration | integer | No | 2-15 seconds, default 5 |
audio_urls | string[] | No | Optional reference audio URL(s); the first is used |
Image-to-Video Input
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt |
image_urls | string[] | Yes | Exactly 1 public HTTP(S) image URL for the first frame. Base64 is not supported. |
audio_urls | string[] | No | Optional driving audio URL(s); the first is used |
duration | integer | No | 2-15 seconds, default 5 |
audio | boolean | No | Whether to generate audio, default decided by the upstream model |
Output aspect ratio follows the first-frame image.
Reference-to-Video Input
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text prompt. Refer to references as character1, character2, etc. by order. |
image_urls | string[] | No* | Reference image URLs, max 5 |
video_urls | string[] | No* | Reference video URLs, max 3 |
aspect_ratio | string | No | 16:9, 9:16, 1:1, 4:3, or 3:4; default 16:9 |
duration | integer | No | 2-10 seconds, default 5 |
audio | boolean | No | Whether to generate audio, default decided by the upstream model |
* At least one of image_urls or video_urls is required, and their combined count cannot exceed 5.
Examples
Text-to-Video
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-2.6-text-to-video",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "A cinematic shot of a small robot walking through a rainy neon alley",
"aspect_ratio": "16:9",
"resolution": "1080p",
"duration": 5
}
}'
Image-to-Video
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-2.6-image-to-video",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "The subject turns toward the camera while the background lights move softly",
"image_urls": ["https://example.com/first-frame.png"],
"resolution": "1080p",
"duration": 5
}
}'
Reference-to-Video
curl -X POST https://api.aivideoapi.ai/v1/videos/generations \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "wan-2.6-reference-to-video",
"callback_url": "https://your-server.com/webhook",
"input": {
"prompt": "character1 walks into the room and speaks to character2.",
"image_urls": ["https://example.com/character1.png"],
"video_urls": ["https://example.com/character2.mp4"],
"aspect_ratio": "16:9",
"resolution": "1080p",
"duration": 8,
"shot_type": "multi"
}
}'
Response
{
"code": 200,
"msg": "success",
"data": {
"taskId": "8b6a5162-5c91-4a42-8e80-4c8ef5486f24"
}
}
Query Task
curl https://api.aivideoapi.ai/v1/tasks/{taskId} \
-H "Authorization: Bearer sk-your-api-key"
Status transitions: pending -> processing -> completed or failed.
When a task fails, pre-charged credits are automatically refunded.
Error Codes
When a request fails, the API returns a JSON error response:
{
"error": {
"code": "insufficient_credits",
"message": "Your credit balance is too low. Please top up.",
"type": "billing_error"
}
}
Error Reference
| HTTP Status | Code | Type | Description |
|---|---|---|---|
| 400 | invalid_request | invalid_request_error | Missing or invalid parameters |
| 401 | invalid_api_key | authentication_error | API key is invalid, disabled, or deleted |
| 402 | insufficient_credits | billing_error | Credit balance too low, please top up |
| 403 | ip_not_allowed | permission_error | Request IP not in the key's allowlist |
| 404 | model_not_found | invalid_request_error | Model does not exist or is inactive |
| 404 | task_not_found | invalid_request_error | Task ID does not exist |
| 429 | rate_limit_exceeded | rate_limit_error | Too many requests, please slow down |
| 429 | spend_limit_exceeded | billing_error | Key spend limit reached (hourly/daily/total) |
| 500 | internal_error | api_error | Unexpected server error |
| 503 | upstream_error | upstream_error | Upstream AI provider returned an error |
Common Scenarios
invalid_request (400)
Returned when required fields are missing or invalid.
{
"error": {
"code": "invalid_request",
"message": "'model' is required.",
"type": "invalid_request_error"
}
}
insufficient_credits (402)
Your balance is too low. Check your balance with GET /v1/credits and top up in Dashboard > Billing.
invalid_api_key (401)
Possible causes:
- The key does not start with
sk- - The key has been disabled or deleted
- The user account has been banned
upstream_error (503)
The upstream AI provider returned an error. This may happen when:
- The input contains sensitive or prohibited content
- The provider is temporarily unavailable
- The request parameters are not supported by the provider
Credits are automatically refunded when a task fails due to upstream errors.