# Wan 2.6 API Complete API reference for Wan 2.6 video generation models by Alibaba. ## Model Variants This API supports two model variants: | Model | ID | Description | |-------|-----|-------------| | **Wan 2.6 Text to Video** | `wan-2.6-text-to-video` | High-quality text-to-video synthesis | | **Wan 2.6 Image to Video** | `wan-2.6-image-to-video` | Image animation with motion | ## Quick Comparison | Feature | Text to Video | Image to Video | |---------|---------------|----------------| | Input | Text prompt | Image + Text prompt | | Duration Range | 2-15 seconds | 2-15 seconds | | Resolution Options | 720p, 1080p | 720p, 1080p | | Start Frame | Not supported | Required | | End Frame | Not supported | Not supported | | Audio Support | ✅ Yes | ✅ Yes | | Audio URL | ✅ Yes | ✅ Yes | ## Wan 2.6 Text to Video ### Endpoint ``` POST /api/v1/video/task ``` ### Request Parameters #### Required | Parameter | Type | Description | |-----------|------|-------------| | `model_name` | string | Must be `"wan-2.6-text-to-video"` | | `prompt` | string | Video generation prompt | | `duration` | number | Video duration in seconds (2-15) | | `resolution` | string | Output resolution: `"720p"` or `"1080p"` | #### Optional | Parameter | Type | Description | |-----------|------|-------------| | `aspect_ratio` | string | Video aspect ratio: `"1:1"`, `"16:9"`, `"3:4"`, `"4:3"`, `"9:16"` | | `audio_url` | string | Audio file URL to be used in the video | ### Example Request ```javascript const response = await fetch('https://api.flaq.ai/api/v1/video/task', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ model_name: 'wan-2.6-text-to-video', prompt: 'A cat playing with a ball of yarn', duration: 5, resolution: '1080p' }) }); const { data } = await response.json(); const taskId = data.task_id; ``` ## Wan 2.6 Image to Video ### Request Parameters #### Required | Parameter | Type | Description | |-----------|------|-------------| | `model_name` | string | Must be `"wan-2.6-image-to-video"` | | `prompt` | string | Video generation prompt | | `duration` | number | Video duration in seconds (2-15) | | `resolution` | string | Output resolution: `"720p"` or `"1080p"` | | `image_url` | string | The first frame of the video | #### Optional | Parameter | Type | Description | |-----------|------|-------------| | `audio_url` | string | Audio file URL to be used in the video | ### Example Request ```javascript { model_name: 'wan-2.6-image-to-video', image_url: 'https://example.com/image.jpg', prompt: 'Gentle camera pan from left to right', duration: 5, resolution: '1080p' } ``` ## Response Format ### Initial Response Both models return a `task_id` for polling: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "submitted" } } ``` ### Polling Response Poll `/api/v1/video/{taskId}` to check status: ```json { "code": 0, "message": "success", "data": { "task_id": "{task_id}", "response_url": "https://api.flaq.ai/api/v1/video/{task_id}", "task_status": "succeed", "task_status_msg": null, "task_result": { "credit": 0.2, "videos": [ { "url": "https://example.com/generated-video.mp4" } ] } } } ``` ### Status Values - `submitted`: Task accepted and waiting to be processed - `processing`: Video generation in progress - `succeed`: Video generation completed - `failed`: Video generation failed ## Processing Time Typical processing time: 2-5 minutes depending on duration and resolution settings. Longer videos (10-15 seconds) may take up to 8 minutes. ## Best Practices 1. **Describe Scene & Motion**: Include both scene content and camera movement in prompts 2. **Resolution Selection**: Use 720p for faster processing, 1080p for highest quality 3. **Duration Planning**: Longer videos cost more (per-second pricing) 4. **Audio Integration**: Can add custom audio via `audio_url` parameter 5. **Image Quality**: For image-to-video, use high-quality input images for best results ## Example Use Cases ### Product Demo Video ```javascript { model_name: 'wan-2.6-text-to-video', prompt: 'Smooth 360-degree rotation of a luxury watch on a pedestal', duration: 8, resolution: '1080p' } ``` ### Animated Portrait ```javascript { model_name: 'wan-2.6-image-to-video', image_url: 'portrait.jpg', prompt: 'Subtle head movement, natural breathing, soft smile', duration: 5, resolution: '1080p' } ``` ### Scene with Audio ```javascript { model_name: 'wan-2.6-text-to-video', prompt: 'Ocean waves crashing on a beach at sunset', duration: 10, resolution: '1080p', audio_url: 'https://example.com/ocean-sounds.mp3' } ```