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
The video_url is valid for 24 hours. Download the video in time.
Applicable scope
- Models supported vary by region, and resources are independent of each other. For the models supported in each region, see the Model Studio console.
- When making calls, ensure that the model, Endpoint URL, and API Key all belong to the same region; cross-region calls will fail.
Core capabilities
First and last frame to video
Supported models: All models.
Feature description: Generates a video (without sound) with a smooth transition based on the first frame and the last frame.
Parameter settings:
first_frame_url: Required. You must provide the first frame image.last_frame_url: Required. You must provide the last frame image.prompt: Optional, but recommended. It controls the changes in the video.
| Prompt | First frame | Last frame | Output video |
| Realistic style, a small black cat curiously looking up at the sky, the camera gradually rises from eye level, and finally captures its curious gaze from a top-down angle. | ![]() | ![]() |
- Python SDK
- Java SDK
- curl
Ensure that the DashScope Python SDK version is 2.0.1 or later. For updates, refer to Install SDK.
Use video effects
Supported models: wanx2.1-kf2v-plus.
Feature description: You only need to provide the first frame, without a prompt or last frame image, and directly use the built-in effect template to apply a specific effect.
Parameter settings:
template: Required. Specifies the effect name (for example, "mech1" for the Mechanical Awakening effect). Before making calls, see the Wanx I2V video effects list to confirm whether the model supports the effect; otherwise, the call may fail.first_frame_url: Required. You must provide the first frame image.last_frame_url: Ignored. When using effects, the last_frame_url field is invalid; leave it empty or do not pass it.prompt: Ignored. When using effects, the prompt field is invalid; leave it empty or do not pass it.
| First frame | Output video (effect video) |
![]() |
- Python SDK
- Java SDK
- curl
Ensure that the DashScope Python SDK version is 2.0.1 or later. For updates, refer to Install SDK.
How to input images
- 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, SDK) Recommended
Method 1: Image URL (HTTP API, SDK) Recommended
- Public URL: Supports the HTTP or HTTPS protocol. Example: https://xxxx/xxx.png.
- Temporary URL: Supports the OSS protocol. You must obtain a temporary URL by uploading a file. Example: oss://dashscope-instant/xxx/xxx.png.
Method 2: Local file path (SDK only)
Method 2: Local file path (SDK only)
Operating system | File path to pass in | Example (absolute path) | Example (relative path) |
|---|---|---|---|
Linux / macOS | file:/{absolute or relative path of the file} | file:///home/images/test.png | file://./images/test.png |
Windows | file://D:/images/test.png | file://./images/test.png |
Operating system | File path to pass in | Example (absolute path) |
|---|---|---|
Linux / macOS | file:/{absolute path of the file} | file:///home/images/test.png |
Windows | file://{absolute path of the file} | file:///D:/images/test.png |
Method 3: Base64-encoded string (HTTP API, SDK)
Method 3: Base64-encoded string (HTTP API, SDK)
-
Example value:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABDg......(truncated for demonstration only). -
Format requirements: Follow the
data:{MIME_type};base64,{base64_data}format, where:- {base64_data}: the string obtained by Base64-encoding the image file.
-
{MIME_type}: the media type of the image, which must correspond to 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 ways to input images
Output video
- Video count: 1.
- Video specifications: Output specifications vary by model. For details, see Video specifications.
- Video URL validity: 24 hours.
-
Video dimensions: determined by the input first frame image and the set
resolution.- The model tries to keep the aspect ratio of the input first frame image unchanged while scaling the total pixel count close to the target. Due to encoding specifications, the width and height of the output video must be divisible by 16, and the model automatically fine-tunes the dimensions.
- For example: input image 750×1000 (aspect ratio 3:4 = 0.75), with resolution set to "720P" (target total pixels ≈ 0.92 million). The final output may be 816 × 1104 (aspect ratio ≈ 0.739, total pixels ≈ 0.9 million), with both width and height being multiples of 16.
Billing and rate limits
- For model free quotas and billing unit prices, see Model prices.
- For model rate limits, see Wan series.
-
Billing details:
- Input is not billed; output is billed. Output is billed by the number of video seconds successfully generated.
- Failed model calls or processing errors incur no charges and do not consume the new user free quota.
- I2V also supports savings plans.
API reference
I2V based on 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 current API does not support directly specifying the video aspect ratio. You can only set the video resolution with the resolution parameter.
resolution controls the total number of pixels in the video, not a strictly fixed aspect ratio. The model prioritizes preserving the original aspect ratio of the first frame image (first_frame_url) and fine-tunes it on that basis to meet video encoding requirements (that is, both width and height must be multiples of 16). Therefore, if you want an output close to 3:4, we recommend uploading a first frame image with an aspect ratio of 3:4, and the model will keep that ratio as much as possible.
For example: input image 750×1000 (aspect ratio 3:4 = 0.75), with resolution set to "720P" (target total pixels ≈ 0.92 million). The final output may be 816 × 1104 (aspect ratio ≈ 0.739, total pixels ≈ 0.9 million), with both width and height being multiples of 16.
Q: Why does the “url error, please check url!” error occur when running SDK code?
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).
- The DashScope Python SDK version must be 2.0.1 or later.
- The DashScope Java SDK version must be
2.22.6or later.




