The Wan image-to-video model supports multi-modal input (text, images, audio, and video) and can perform three main tasks: video generation from the first frame, video generation from the first and last frames, and video continuation.
The new image-to-video API (wan2.7-i2v model) supports these three tasks. Use this new API.
The original image-to-video from first frame API (wan2.6 and earlier models) supports only video generation from the first frame.
Availability
For successful API calls, use the same region for model, endpoint URL, and API key. Cross-region calls will fail.
Select a model: Confirm the model is available in your target region.
Select a URL: Choose the corresponding regional endpoint URL.
Configure an API key: Get an API key for the region, then configure the API key as an environment variable.
The sample code in this topic applies to the Singapore region.
HTTP
This API uses the new image-to-video protocol and supports only the wan2.7 model.
Image-to-video tasks take 1 to 5 minutes, so the API uses asynchronous invocation. The process has two steps:
Step 1: Create a task and get the task ID
Singapore
POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
Beijing
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis
After the task is created, use the returned
task_idto query the result. Thetask_idis valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result.For a beginner's tutorial, see Postman.
Request parameters | Video generation from the first frameGenerate a video based on a first frame image and audio. Video generation from the first and last framesPass a first frame and a last frame to generate a video. Video continuationGenerate subsequent content based on an initial video clip. |
Content-Type The content type of the request. Must be | |
Authorization The authentication credentials using a Model Studio API key. Example: | |
X-DashScope-Async Enables asynchronous processing. Must be Important Returns "current user api does not support synchronous calls" error if not included. | |
Request body | |
model The model name. For a list of models and their pricing, see Model pricing. Example: wan2.7-i2v. | |
input The basic input information, such as the prompt. | |
parameters Video processing parameters, such as resolution, duration, prompt rewriting, and watermarks. |
Response parameters | Successful responseSave the Error responseTask creation failed. See error codes to resolve the issue. |
output The task output information. | |
request_id Unique identifier for the request. Use for tracing and troubleshooting issues. | |
code The error code. Returned only when the request fails. See error codes for details. | |
message Detailed error message. Returned only when the request fails. See error codes for details. |
Step 2: Query the result by task ID
Singapore
GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}
Beijing
GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}
Polling suggestion: Video generation can take several minutes. Use a polling mechanism with a reasonable query interval, such as 15 seconds, to retrieve the result.
Task status transition: PENDING → RUNNING → SUCCEEDED or FAILED.
Result URL: After the task is successful, a video URL is returned. The URL is valid for 24 hours. After you retrieve the URL, you must immediately download and save the video to a permanent storage service, such as Object Storage Service (OSS).
task_id validity: 24 hours. After this period, you cannot query the result, and the API returns a task status of
UNKNOWN.
Request parameters | Query task resultReplace |
Headers | |
Authorization The authentication credentials using a Model Studio API key. Example: | |
Path parameters | |
task_id The ID of the task to query. |
Response parameters | Task successfulVideo URLs are retained for only 24 hours and then automatically purged. Save generated videos promptly. Task failedWhen a task fails, Task query expiredThe |
output The task output information. | |
usage Statistics for the output information. Only successful results are counted. | |
request_id Unique identifier for the request. Use for tracing and troubleshooting issues. |
Limitations
Data validity: The
task_idandvideo_urlare retained for only 24 hours. After this period, you cannot query or download them.Content moderation: The input content (such as prompts, images, and videos) and the output video are subject to content moderation. If the content violates the rules, the system returns an "IPInfringementSuspect" or "DataInspectionFailed" error. For more information, see Error messages.
Error codes
If a model call fails and returns an error message, see Error messages to resolve the issue.
FAQ
Q: How do I generate a video with a specific aspect ratio, such as 3:4?
A: The output video's aspect ratio is determined by the input material (first frame image or first video clip). However, the output aspect ratio is not guaranteed to be exactly the same as the input ratio. For example, it may not be exactly 3:4. A slight drift may occur.
The following example explains the logic using an "input first frame image":
Why does bias occur?
Execution logic: The system uses the input image's aspect ratio as a baseline reference. It combines this with the target total pixels of the
resolutiontier. The video width and height must be multiples of 16 because of video encoding specifications. The system automatically adjusts to the closest valid resolution.Calculation example: An input first frame image measures 750 × 1000 pixels (aspect ratio 3:4 = 0.75). The resolution is set to "720P" (with a target of approximately 920,000 total pixels). The actual output video resolution is 816 × 1104 pixels (aspect ratio ≈ 0.739, approximately 900,000 total pixels).
Recommendations:
Input control: Use a first frame or video clip that matches your target aspect ratio.
Post-processing: If you have strict aspect ratio requirements, use an editing tool to crop the video or add black bars after generation.
Q: How do I get the whitelist of domain names for video storage access?
A: Videos generated by models are stored in OSS. The API returns a temporary public URL. To configure a firewall whitelist for this download URL, note the following: The underlying storage may change dynamically. This topic does not provide a fixed OSS domain name whitelist to prevent access issues caused by outdated information. If you have security control requirements, contact your account manager to obtain the latest OSS domain name list.