Wan AI Video Generator API documentation
Generate videos with Wan AI Video Generator (Alibaba). Supports both text and image input modes. The reference mode accepts image, video, audio inputs.
Endpoints
| Contract item | Value |
|---|---|
| Capability | wan-ai-video-generator |
| Submit | POST https://vidmage.ai/api/v1/wan-ai-video-generator/submit |
| Query | POST https://vidmage.ai/api/v1/wan-ai-video-generator/query |
| Task identifier | taskId |
| Result field | videoUrl |
Authenticate with Authorization: Bearer YOUR_API_KEY. Save the task identifier and query the same capability. Use a stable Idempotency-Key for submission retries.
Product guide: Wan Video API
Parameters and input rules
| Field | Type | Required | Default | Meaning and limits |
|---|---|---|---|---|
prompt | string | No | Not specified | Text prompt describing the video to generate (max 5000 chars). Optional only in provider modes whose image input fully defines the generation. Maximum characters: 5000 |
imageUrl | string | No | Not specified | Optional input image URL. When provided, the task runs in image-to-video mode. In that mode, output ratio is inferred from the input image. |
imageUrls | string[] | No | Not specified | Optional multimodal reference images. Public URLs only; images and videos together are limited to 5. Maximum items: 5 |
videoUrls | string[] | No | Not specified | Optional multimodal reference videos. Images and videos together are limited to 5. Maximum items: 5 |
audioUrls | string[] | No | Not specified | Optional multimodal reference audio.. Maximum items: 1 |
lastFrameUrl | string | No | Not specified | Optional public URL for the final frame in image-to-video mode. |
duration | string | No | "5" | Video duration in seconds. Values: "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" |
aspectRatio | string | No | "16:9" | Output aspect ratio for modes that expose a ratio parameter. Ignored when imageUrl selects a mode whose ratio is inferred from the input image. Values: "16:9", "9:16", "1:1", "4:3", "3:4" |
resolution | string | No | "720p" | Output resolution tier. Values: "720p", "1080p" |
audioUrl | string | No | Not specified | Optional background music or audio track. |
negativePrompt | string | No | Not specified | Describe unwanted video content or artifacts. Minimum characters: 0Maximum characters: 500 |
promptExtend | boolean | No | true | Rewrite and enrich the prompt automatically. |
seed | integer | No | Not specified | Random seed; leave unset for a random result. Minimum: 0Maximum: 2147483647Multiple of: 1 |
Images and videos together may contain at most 5 references.
text to video
These are public VidMage field names. The server maps them to provider fields. Input media selects the mode; use its limits together with the parameter table.
| Control | Mode-specific rule |
|---|---|
prompt | Required; 1–5000 characters. |
duration | JSON string. Values: "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15". Default: 5. |
aspectRatio | Values: "16:9", "9:16", "1:1", "4:3", "3:4". Default: 16:9. |
resolution | Values: "720p", "1080p". Default: 720p. |
audioUrl | Optional background music or audio track. |
negativePrompt | Describe unwanted video content or artifacts. Minimum characters: 0Maximum characters: 500 |
promptExtend | Rewrite and enrich the prompt automatically. Default: true |
seed | Random seed; leave unset for a random result. Minimum: 0Maximum: 2147483647Multiple of: 1 |
image to video
These are public VidMage field names. The server maps them to provider fields. Input media selects the mode; use its limits together with the parameter table.
| Control | Mode-specific rule |
|---|---|
prompt | Optional; 0–5000 characters. |
duration | JSON string. Values: "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15". Default: 5. |
aspectRatio | Not used in this mode. |
resolution | Values: "720p", "1080p". Default: 720p. |
imageUrl | Formats: jpg, jpeg, png, bmp, webp. |
lastFrameUrl | Optional final-frame image. |
audioUrl | Optional background music or audio track. |
negativePrompt | Describe unwanted video content or artifacts. Minimum characters: 0Maximum characters: 500 |
promptExtend | Rewrite and enrich the prompt automatically. Default: true |
seed | Random seed; leave unset for a random result. Minimum: 0Maximum: 2147483647Multiple of: 1 |
multimodal video
These are public VidMage field names. The server maps them to provider fields. Input media selects the mode; use its limits together with the parameter table.
| Control | Mode-specific rule |
|---|---|
prompt | Required; 1–5000 characters. |
duration | JSON string. Values: "2", "3", "4", "5", "6", "7", "8", "9", "10". Default: 5. |
aspectRatio | Values: "16:9", "9:16", "1:1", "4:3", "3:4". Default: 16:9. |
resolution | Values: "720p", "1080p". Default: 1080p. |
imageUrls | Up to 5 files. Formats: jpg, jpeg, png, bmp, webp. |
videoUrls | Up to 5 files. Formats: mp4, mov. |
audioUrls | Up to 1 files. Formats: mp3, wav. |
| References | At least one reference input is required. |
| Combined references | Images and videos together: maximum 5. |
negativePrompt | Describe unwanted video content or artifacts. Minimum characters: 0Maximum characters: 500 |
promptExtend | Rewrite and enrich the prompt automatically. Default: true |
seed | Random seed; leave unset for a random result. Minimum: 0Maximum: 2147483647Multiple of: 1 |
Example request
{
"prompt": "A slow crane shot rises above an ancient riverside town as lanterns illuminate the evening mist",
"duration": "5",
"aspectRatio": "16:9",
"resolution": "720p",
"promptExtend": true
}# Set VIDMAGE_IDEMPOTENCY_KEY to a unique value for this task; preserve it for transport retries.
curl -X POST "https://vidmage.ai/api/v1/wan-ai-video-generator/submit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: ${VIDMAGE_IDEMPOTENCY_KEY}" \
-H "Content-Type: application/json" \
-d '{"prompt":"A slow crane shot rises above an ancient riverside town as lanterns illuminate the evening mist","duration":"5","aspectRatio":"16:9","resolution":"720p","promptExtend":true}'
# -> { "success": true, "taskId": "...", "creditsConsumed": ... }Task results and recovery
URL of the generated video. Read videoUrl from the completed query response. Preserve taskId while the task is running.
curl -X POST "https://vidmage.ai/api/v1/wan-ai-video-generator/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "taskId": "TASK_ID_FROM_SUBMIT" }'
# -> { "success": true, "data": { "status": "...", "videoUrl": "https://..." } }Submission and task queries report the available task and usage information. A timeout is not a confirmed failure. Recover the existing task instead of resubmitting.
For face selection and error recovery, follow Task lifecycle. MCP uses the normalized taskId argument in get_task_result, including capabilities whose REST identifier is requestId.
Credits
| Component / option | Rate | Minimum |
|---|---|---|
| 720p | 15 credits / second | — |
| 1080p | 30 credits / second | — |
Base charge = duration × the selected resolution rate.
Use the Playground or the MCP credit estimator for your exact inputs. Credits and billing.
