The Wan image-to-video model generates smooth videos from a first-frame image, a last-frame image, and an optional text prompt.
- Core capabilities: Fixed 5-second duration, custom resolution (480P/720P/1080P), prompt rewriting, and watermarking.
- Video effect templates: Upload only the first-frame image and select an effect template to generate a video with a specific dynamic effect.
Getting started
| Prompt | First frame | Last frame | Output video |
| A cute blue monster with a slightly sad expression stands in the rain. The camera slowly zooms in and stops on the moment it looks up at the sky. | ![]() | ![]() |
- Python SDK
- Java SDK
- curl
video_url expires after 24 hours. Download the video promptly.
Availability
- Supported models vary by region. Resources are isolated between regions. For supported models in each region, see the Model Studio console.
- When making a call, make sure your model, endpoint URL, and API key all belong to the same region. Cross-region calls fail.
Core capabilities
Generate video from first and last frames
Supported models: All models.
Generates smooth videos from first-frame and last-frame images.
Parameters:
first_frame_url: Required. Provide the first-frame image.last_frame_url: Required. Provide the last-frame image.prompt: Optional (recommended). Controls how the video changes over time.
| Prompt | First frame | Last frame | Output video |
| Realistic style. A curious black kitten looks up at the sky. The camera starts at eye level and gradually rises until it captures the kitten’s curious gaze from above. | ![]() | ![]() |
- Python SDK
- Java SDK
- curl
Requires DashScope Python SDK ≥ 1.25.8. Upgrade if needed.
Use video effects
Supported model: wanx2.1-kf2v-plus.
Upload only the first-frame image with a built-in effect template -- no prompt or last-frame needed.
Parameters:
template: Required. Specify the effect name (e.g., mech1). Before calling the API, check the video effect list to confirm your model supports the effect -- unsupported effects cause failures.first_frame_url: Required. Provide the first-frame image.last_frame_url: Ignored. When using effects, this field has no effect. Leave it empty or omit it.prompt: Ignored. When using effects, this field has no effect. Leave it empty or omit it.
| First frame | Output video (with effect) |
![]() |
- Python SDK
- Java SDK
- curl
Requires DashScope Python SDK ≥ 1.25.8. Upgrade if needed.
Input image
- Number of images: One first-frame image and one last-frame image.
- Input methods: Image URL, local file path, or Base64-encoded string.
Method 1: Image URL (HTTP API and SDK) Recommended
Method 1: Image URL (HTTP API and SDK) Recommended
- Public URL: HTTP or HTTPS (e.g., https://xxxx/xxx.png).
- Temporary URL: OSS protocol (upload file first). Example: oss://dashscope-instant/xxx/xxx.png.
Method 2: Local file path (SDK only)
Method 2: Local file path (SDK only)
Operating system | Input file path | Example (absolute path) | Example (relative path) |
|---|---|---|---|
Linux / macOS | file://{absolute or relative path} | file:///home/images/test.png | file://./images/test.png |
Windows | file://D:/images/test.png | file://./images/test.png |
Operating system | Input file path | Example (absolute path) |
|---|---|---|
Linux / macOS | file://{absolute path} | file:///home/images/test.png |
Windows | file:///{absolute path} | file:///D:/images/test.png |
Method 3: Base64-encoded string (HTTP API and SDK)
Method 3: Base64-encoded string (HTTP API and SDK)
-
Example value:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABDg......(truncated for illustration only). -
Format requirement: Must follow the format
data:{MIME_type};base64,{base64_data}, where:- {base64_data}: The Base64-encoded string of the image file.
-
{MIME_type}: The media type of the image. It must match the file format.
Image format
MIME type
JPEG
image/jpeg
JPG
image/jpeg
PNG
image/png
BMP
image/bmp
WEBP
image/webp
Sample code: Multiple image input methods
Output video
- Number of videos: One.
- Specifications: Specifications vary by model. See Video specifications.
- URL expiration: 24 hours.
-
Dimensions: Determined by the first-frame image and the
resolutionsetting.- The model preserves the first-frame's aspect ratio and scales total pixel count to the target. Output dimensions are adjusted automatically to be divisible by 16 (encoding requirement).
- Example: 750×1000 input (3:4) with resolution="720P" (target ≈920K pixels) may output 816×1104 (≈0.739 ratio, ≈900K pixels, both divisible by 16).
Billing and rate limiting
- For free quota and pricing details, see Wanx-Image-to-Video-First-Last-Frame.
- For model rate limiting, see Wanxiang series.
-
Billing details:
- Input is free. Output billing is based on successful video seconds generated.
- Failed calls incur no charges and don't consume free quota.
- Image-to-video also supports savings plans.
API reference
Image-to-video - first and last frames - API reference
FAQ
Q: How do I generate a video with a specific aspect ratio (such as 3:4)?
A: The API doesn't support direct aspect ratio control -- only resolution.
The resolution parameter controls pixel count, not aspect ratio. The model preserves the first-frame's aspect ratio (first_frame_url) with minor adjustments for encoding (dimensions must be multiples of 16). For 3:4 video, upload a 3:4 first-frame image.
Example: 750×1000 input (3:4) with resolution="720P" (target ≈920K pixels) may output 816×1104 (≈0.739 ratio, ≈900K pixels, both divisible by 16).
Q: Why do I get a “url error, please check url!” error when running the SDK code?
A: Ensure your SDK version meets the minimum requirement: DashScope Python SDK ≥ 1.25.8 or DashScope Java SDK ≥ 2.22.6. Older versions may show "url error, please check url!" errors. Upgrade the SDK.



