Wan 2.7
Generate videos from text or images with the Alibaba Wan 2.7 model — first-and-last-frame, video continuation, automatic audio, up to 1080p.
POST /v2/videos/generate — model: "wan-2.7"
Combined text-to-video and image-to-video generation at 720p or 1080p, 2–15 seconds. Supports first-and-last-frame (FLF) constraints, continuation from an existing video clip, custom driving audio, and automatic prompt expansion. When no audio is provided the model auto-generates a matching soundtrack.
The mode is selected automatically:
- Provide neither
imagenorfirst_clip→ text-to-video. - Provide
image→ image-to-video (optionally withlast_framefor FLF). - Provide
first_clip→ continuation from the given video (optionally withlast_frame).
image and first_clip are mutually exclusive.
See Video Generation overview for common request fields, response format, and error codes.
Model-specific parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
wan27Params.image | string | No | — | First-frame image URL for I2V. Mutually exclusive with first_clip. |
wan27Params.last_frame | string | No | — | Optional last-frame image URL. Requires image (FLF) or first_clip (continuation with target last frame). |
wan27Params.first_clip | string | No | — | Source clip (2–10 s) to continue from. Mutually exclusive with image. |
wan27Params.audio | string | No | — | Driving audio URL (wav/mp3, 3–30 s, ≤ 15 MB). Omit to auto-generate. |
wan27Params.resolution | string | No | "1080p" | Output resolution: "720p" or "1080p". |
wan27Params.aspect_ratio | string | No | — | T2V only. One of "16:9", "9:16", "1:1", "4:3", "3:4". I2V inherits aspect ratio from the input. |
wan27Params.duration | number | No | 5 | Video duration in seconds (integer, 2–15). |
wan27Params.negative_prompt | string | No | — | Elements to avoid in the generated video. |
wan27Params.enable_prompt_expansion | boolean | No | — | Enable automatic prompt optimization. |
wan27Params.seed | number | No | — | Random seed for reproducible generation. |
Credit cost
Pricing is per second of generated video (credits = rate × duration).
| Mode | Resolution | Credits / second |
|---|---|---|
| T2V | 720p | 17 |
| T2V | 1080p | 17 |
| I2V (image or first_clip) | 720p | 17 |
| I2V (image or first_clip) | 1080p | 26 |
A 10-second I2V clip at 1080p therefore costs 26 × 10 = 260 credits.
Code examples
curl -X POST https://api.apiframe.ai/v2/videos/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
"model": "wan-2.7",
"wan27Params": {
"duration": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
"enable_prompt_expansion": true
}
}'import requests
response = requests.post(
"https://api.apiframe.ai/v2/videos/generate",
headers={
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
json={
"prompt": "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
"model": "wan-2.7",
"wan27Params": {
"duration": 8,
"resolution": "1080p",
"aspect_ratio": "16:9",
"enable_prompt_expansion": True,
},
},
)
print(response.json())const response = await fetch("https://api.apiframe.ai/v2/videos/generate", {
method: "POST",
headers: {
"X-API-Key": "afk_your_api_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
prompt: "A cinematic slow-motion shot of a tiger running through tall grass at golden hour",
model: "wan-2.7",
wan27Params: {
duration: 8,
resolution: "1080p",
aspect_ratio: "16:9",
enable_prompt_expansion: true,
},
}),
});
console.log(await response.json());Image-to-video (with optional last frame)
curl -X POST https://api.apiframe.ai/v2/videos/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The person turns to camera and smiles",
"model": "wan-2.7",
"wan27Params": {
"image": "https://example.com/start.jpg",
"last_frame": "https://example.com/end.jpg",
"duration": 5,
"resolution": "720p"
}
}'Continuation from an existing clip
curl -X POST https://api.apiframe.ai/v2/videos/generate \
-H "X-API-Key: afk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "The dragon takes off and flies over the mountains",
"model": "wan-2.7",
"wan27Params": {
"first_clip": "https://example.com/intro.mp4",
"duration": 8,
"resolution": "1080p"
}
}'Try it
/v2/videos/generateTry it