Wan 2.7 API
Complete API reference for Wan 2.7 video generation models by Alibaba.
Model Variants
This API supports four model variants:
Quick Comparison
Wan 2.7 Text to Video
Endpoint
POST /api/v1/video/task
Request Parameters
Required
Optional
Example Request
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.7-text-to-video',
prompt: 'A cat playing with a ball of yarn in a sunlit room',
duration: 6,
resolution: '720p',
aspect_ratio: '16:9',
negative_prompt: 'blur, low quality',
seed: 42
})
});
const { data } = await response.json();
const taskId = data.task_id;
Wan 2.7 Image to Video
Request Parameters
Required
Optional
Example Request
{
model_name: 'wan-2.7-image-to-video',
image_url: 'https://example.com/first-frame.jpg',
image_end_url: 'https://example.com/last-frame.jpg',
video_url: 'https://example.com/reference-continuation.mp4',
audio_url: 'https://example.com/driving-audio.mp3',
prompt: 'Gentle camera push-in; leaves rustle softly in the breeze',
duration: 6,
resolution: '720p',
negative_prompt: 'blur, low quality',
seed: 42
}
Wan 2.7 Video Edit
Request Parameters
Required
Optional
Example Request
{
model_name: 'wan-2.7-video-edit',
prompt: 'Replace the sky with warm sunset colors, keep subjects natural',
negative_prompt: 'artifacts, flicker',
seed: 42,
video_url: 'https://example.com/source.mp4',
images: ['https://example.com/ref-a.jpg', 'https://example.com/ref-b.jpg'],
audio_setting: 'auto'
}
Wan 2.7 Reference to Video
Generate a new video from ordered image and video references, with optional voice guidance from one audio clip.
Request Parameters
Required
Reference Media
At least one reference image or reference video is required. images and videos may contain no more than 5 items in total.
Optional
@ (AT) Reference Placeholders
The @ (AT) reference feature links reference media to the prompt through numbered <<<...>>> placeholders. Numbering starts at 1 independently for each media type and follows the order of the corresponding array.
Example Request
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Use image one for the hero and video one for the motion; keep the hero voice consistent with audio one',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: ['https://example.com/hero-reference.jpg'],
videos: ['https://example.com/motion-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
@ (AT) Reference-to-Video Request Example
{
model_name: 'wan-2.7-reference-to-video',
prompt: 'Place the presenter from <<<image_1>>> in the studio from <<<image_2>>>, follow the camera path in <<<video_1>>>, and use the reference voice from <<<audio_1>>>',
resolution: '1080p',
duration: 8,
aspect_ratio: '16:9',
images: [
'https://example.com/presenter-reference.jpg',
'https://example.com/studio-reference.jpg'
],
videos: ['https://example.com/camera-path-reference.mp4'],
audios: ['https://example.com/voice-reference.mp3'],
negative_prompt: 'flicker, distorted hands, duplicate subjects',
seed: 42
}
Initial Response
All models return a task_id for polling:
{
"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 GET /api/v1/video/{taskId} to check status:
{
"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": {
"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) at 1080p may take up to 8 minutes.
Best Practices
- Describe Scene & Motion: Include both scene content and camera movement in prompts
- Resolution Selection: Use 720p for faster processing, 1080p for highest quality
- Duration Planning: Longer videos cost more (per-second pricing)
- Audio Integration: Add custom audio via
audio_url parameter
- Image Quality: For image-to-video, use high-quality input images for best results
- Video Edit Prompts: Be specific about what to change and what to preserve
- Reference Asset Count: For reference-to-video, keep the combined number of
images and videos at 5 or fewer
- Reference Voice: Use
audios only for voice identity guidance; describe the desired spoken content in your prompt