All Products
Search
Document Center

Alibaba Cloud Model Studio:Image-to-video 2.7

Last Updated:Apr 17, 2026

The Wanxiang 2.7 image-to-video model supports multimodal inputs (text, image, audio, and video). It performs three main tasks: first-frame video generation, first-and-last-frame video generation, and video continuation (from a first video clip or from a first video clip with a last frame).

  • Basic settings: Supports video durations from 2 to 15 seconds in integer values, specified video resolutions (720p or 1080p), intelligent prompt rewriting, and adding watermarks.

  • Audio capabilities: Supports automatic dubbing or uploading audio to achieve audio-visual synchronization.

  • Multi-shot narrative: Generates videos with multiple shots while maintaining subject consistency across shot changes.

Quick links: Try it online (Singapore | Virginia | Beijing) | API reference

Getting started

Input prompt

Input first video clip (2s)

Input last frame image

Output video (12s, 10s continuation)

A man looks down at a wooden box on the ground. He bends over and carefully opens the lid. He stares at the contents of the box, his lips trembling and slightly parted. His brow is furrowed and his eyes are wide with a look of horror.

wan2

Before you make a call, obtain an API key and then configure the API key as an environment variable (This method is being deprecated and will be merged with the standard API key configuration). To make calls using a software development kit (SDK), install the DashScope SDK.

Python SDK

Important

Make sure that your DashScope Python SDK version is 1.25.16 or later before you run the following code.

If you use an earlier version, errors such as "url error, please check url!" may occur. For more information about updating the SDK, see Install the SDK.

# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/image-to-video-general-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If you have not configured the environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "first_clip",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/cqcbkw/wan2.7-i2v-video-continuation.mp4"
    },
    {
        "type": "last_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/mrwahg/wan2.7-i2v-video-continuation.webp"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-i2v",
        media=media,
        resolution="720P",
        duration=12,
        watermark=True,
        prompt="A man looks down at a wooden box on the ground. He bends over and carefully opens the lid. He stares at the contents of the box, his lips trembling and slightly parted. His brow is furrowed and his eyes are wide with a look of horror.",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_sync_call()

Java SDK

Important

Make sure that your DashScope Java SDK version is 2.22.14 or later before you run the following code.

If you use an earlier version, errors such as "url error, please check url!" may occur. For more information about updating the SDK, see Install the SDK.

// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;

import java.util.ArrayList;
import java.util.List;

public class Image2Video {

    static {
        // The following URL is for the Singapore region. If you use a model in the China (Beijing) region, replace the URL with https://dashscope.aliyuncs.com/api/v1
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // If you have not configured the environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void syncCall() {
        VideoSynthesis videoSynthesis = new VideoSynthesis();
        final String prompt = "A man looks down at a wooden box on the ground. He bends over and carefully opens the lid. He stares at the contents of the box, his lips trembling and slightly parted. His brow is furrowed and his eyes are wide with a look of horror.";
        List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/cqcbkw/wan2.7-i2v-video-continuation.mp4")
                    .type("first_clip")
                    .build());
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/mrwahg/wan2.7-i2v-video-continuation.webp")
                    .type("last_frame")
                    .build());
        }};
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-i2v")
                        .prompt(prompt)
                        .media(media)
                        .watermark(true)
                        .duration(12)
                        .resolution("720P")
                        .build();
        VideoSynthesisResult result = null;
        try {
            System.out.println("---sync call, please wait a moment----");
            result = videoSynthesis.call(param);
        } catch (ApiException | NoApiKeyException e){
            throw new RuntimeException(e.getMessage());
        } catch (InputRequiredException e) {
            throw new RuntimeException(e);
        }
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        syncCall();
    }
}

curl

Step 1: Create a task and obtain the task ID

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-i2v",
    "input": {
        "prompt": "A man looks down at a wooden box on the ground. He bends over and carefully opens the lid. He stares at the contents of the box, his lips trembling and slightly parted. His brow is furrowed and his eyes are wide with a look of horror.",
        "media": [
            {
                "type": "first_clip",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/cqcbkw/wan2.7-i2v-video-continuation.mp4"
            },
            {
                "type": "last_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/mrwahg/wan2.7-i2v-video-continuation.webp"
                
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "duration": 12,
        "prompt_extend": true,
        "watermark": true
    }
}'

Step 2: Retrieve the result based on the task ID

Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Sample output

video_url is valid for 24 hours. Download the video promptly.
{
    "request_id": "c1209113-8437-424f-a386-xxxxxx",
    "output": {
        "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
         ...
    },
    ...
}

Scope

Supported models and resources vary by region and are independent of each other. When you make a call, ensure that the model, Endpoint URL, and API key all belong to the same region. Cross-region calls will fail.

Supported models:

International

When the service deployment is international, model inference compute resources are dynamically scheduled worldwide (excluding the Chinese mainland). Static data is stored in the region you select. The supported region for this deployment scope is Singapore.

Model

Features

Input modality

Output video specifications

wan2.7-i2v Recommended

Video with audio

First-frame-to-video, first-and-last-frame-to-video, video continuation, video continuation with last frame control

Multi-shot narrative, audio-video synchronization

Text, image, audio, video

Resolution options: 720P, 1080P

Video duration: [2s, 15s] (integer)

Defined specifications: 30 fps, MP4 (H.264 encoding)

Chinese mainland

When the service deployment is in the Chinese mainland, model inference compute resources are limited to the Chinese mainland. Static data is stored in the region you select. The supported region for this deployment scope is China (Beijing).

Model

Features

Input modality

Output video specifications

wan2.7-i2v Recommended

Video with audio

First-frame-to-video, first-and-last-frame-to-video, video continuation, video continuation with last frame control

Multi-shot narrative, audio-video synchronization

Text, image, audio, video

Resolution options: 720P, 1080P

Video duration: [2s, 15s] (integer)

Defined specifications: 30 fps, MP4 (H.264 encoding)

Note

The sample code in this topic applies to the Singapore region.

Core features

First-frame video generation

Supported models: wan2.7 series models.

Parameter settings: The type field of the media array supports the following two combinations. For more information about media combinations, see How to input media.

  • First frame: Set type to first_frame. The model automatically adds audio to the video.

  • First frame + audio: Set type to first_frame and driving_audio. The model uses the audio to drive video generation, for purposes such as lip-syncing and action timing.

Input prompt

Input first frame image

Output video

A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The light comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.

rap

Input audio:

Python SDK

Make sure that your DashScope Python SDK version is not lower than 1.25.16. For more information, see Install the SDK to update it.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/image-to-video-general-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If you have not configured the environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "first_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
    },
    {
        "type": "driving_audio",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-i2v",
        media=media,
        resolution="720P",
        duration=10,
        watermark=True,
        prompt="A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The light comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_sync_call()

Java SDK

Make sure that your DashScope Java SDK version is not lower than 2.22.14. For more information, see Install the SDK to update it.
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;

import java.util.ArrayList;
import java.util.List;

public class Image2Video {

    static {
        // The following URL is for the Singapore region. If you use a model in the China (Beijing) region, replace the URL with https://dashscope.aliyuncs.com/api/v1
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // If you have not configured the environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void syncCall() {
        VideoSynthesis videoSynthesis = new VideoSynthesis();
        final String prompt = "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The light comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.";
        List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png")
                    .type("first_frame")
                    .build());
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3")
                    .type("driving_audio")
                    .build());
        }};
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-i2v")
                        .prompt(prompt)
                        .media(media)
                        .watermark(true)
                        .duration(10)
                        .resolution("720P")
                        .build();
        VideoSynthesisResult result = null;
        try {
            System.out.println("---sync call, please wait a moment----");
            result = videoSynthesis.call(param);
        } catch (ApiException | NoApiKeyException e){
            throw new RuntimeException(e.getMessage());
        } catch (InputRequiredException e) {
            throw new RuntimeException(e);
        }
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        syncCall();
    }
}

curl

Step 1: Create a task and obtain the task ID

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-i2v",
    "input": {
        "prompt": "A scene of urban fantasy art. A dynamic graffiti art character. A boy made of spray paint comes to life from a concrete wall. He raps an English song at high speed while striking a classic, energetic rapper pose. The scene is set at night under an urban railway bridge. The light comes from a single street lamp, creating a cinematic atmosphere full of high energy and amazing detail. The audio of the video consists entirely of the rap, with no other dialogue or noise.",
        "media": [
            {
                "type": "first_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
            },
            {
                "type": "driving_audio",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
                
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "duration": 10,
        "prompt_extend": true,
        "watermark": true
    }
}'

Step 2: Retrieve the result based on the task ID

Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Sample output

video_url is valid for 24 hours. Download the video promptly.
{
    "request_id": "c1209113-8437-424f-a386-xxxxxx",
    "output": {
        "task_id": "966cebcd-dedc-4962-af88-xxxxxx",
        "task_status": "SUCCEEDED",
        "video_url": "https://dashscope-result-sh.oss-accelerate.aliyuncs.com/xxx.mp4?Expires=xxx",
         ...
    },
    ...
}

First-and-last-frame video generation

Supported models: wan2.7 series models.

Parameter settings: The type field of the media array supports the following two combinations. For more information about media combinations, see How to input media.

  • First frame + last frame: Set type to first_frame and last_frame. The model automatically adds audio to the video.

  • First frame + last frame + audio: Set type to first_frame, last_frame, and driving_audio. The model uses the audio to drive video generation.

Input prompt

Input first frame image

Input last frame image

Output video

In the early morning, just as the sun rises in a pumpkin patch, a small pumpkin is covered with dewdrops. Suddenly, with a 'crack', a fissure appears on the pumpkin. A golden light shines from the crack. The pumpkin splits open with the golden light, and a cloud of white mist appears. A small rabbit emerges from the center of the split pumpkin.

wan2

wan2

Python SDK

Make sure that your DashScope Python SDK version is not lower than 1.25.16. For more information, see Install the SDK to update it.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/image-to-video-general-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If you have not configured the environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "first_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/welyei/wan2.7-i2v-first-frame.webp"
    },
    {
        "type": "last_frame",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/zongha/wan2.7-i2v-last-frame.webp"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-i2v",
        media=media,
        resolution="720P",
        duration=15,
        watermark=True,
        prompt="In the early morning, just as the sun rises in a pumpkin patch, a small pumpkin is covered with dewdrops. Suddenly, with a 'crack', a fissure appears on the pumpkin. A golden light shines from the crack. The pumpkin splits open with the golden light, and a cloud of white mist appears. A small rabbit emerges from the center of the split pumpkin.",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_sync_call()

Java SDK

Make sure that your DashScope Java SDK version is not lower than 2.22.14. For more information, see Install the SDK to update it.
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;

import java.util.ArrayList;
import java.util.List;

public class Image2Video {

    static {
        // The following URL is for the Singapore region. If you use a model in the China (Beijing) region, replace the URL with https://dashscope.aliyuncs.com/api/v1
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // If you have not configured the environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void syncCall() {
        VideoSynthesis videoSynthesis = new VideoSynthesis();
        final String prompt = "In the early morning, just as the sun rises in a pumpkin patch, a small pumpkin is covered with dewdrops. Suddenly, with a 'crack', a fissure appears on the pumpkin. A golden light shines from the crack. The pumpkin splits open with the golden light, and a cloud of white mist appears. A small rabbit emerges from the center of the split pumpkin.";
        List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/welyei/wan2.7-i2v-first-frame.webp")
                    .type("first_frame")
                    .build());
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/zongha/wan2.7-i2v-last-frame.webp")
                    .type("last_frame")
                    .build());
        }};
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-i2v")
                        .prompt(prompt)
                        .media(media)
                        .watermark(true)
                        .duration(15)
                        .resolution("720P")
                        .build();
        VideoSynthesisResult result = null;
        try {
            System.out.println("---sync call, please wait a moment----");
            result = videoSynthesis.call(param);
        } catch (ApiException | NoApiKeyException e){
            throw new RuntimeException(e.getMessage());
        } catch (InputRequiredException e) {
            throw new RuntimeException(e);
        }
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        syncCall();
    }
}

curl

Step 1: Create a task and obtain the task ID

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-i2v",
    "input": {
        "prompt": "In the early morning, just as the sun rises in a pumpkin patch, a small pumpkin is covered with dewdrops. Suddenly, with a 'crack', a fissure appears on the pumpkin. A golden light shines from the crack. The pumpkin splits open with the golden light, and a cloud of white mist appears. A small rabbit emerges from the center of the split pumpkin.",
        "media": [
            {
                "type": "first_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/welyei/wan2.7-i2v-first-frame.webp"
            },
            {
                "type": "last_frame",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/zongha/wan2.7-i2v-last-frame.webp"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "duration": 15,
        "prompt_extend": false,
        "watermark": true
    }
}'

Step 2: Retrieve the result based on the task ID

Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Video continuation

Supported models: wan2.7 series models.

Feature introduction: This feature continues the content from an input video clip. The generated result includes the original input clip, and the duration of the input clip is counted towards the total generated duration. For example, if you input a 2-second video and set the output duration to 12 seconds, the final video will be 12 seconds long, consisting of the original 2-second clip and a 10-second continuation.

Parameter settings: The type field of the media array supports the following two combinations. For more information about media combinations, see How to input media.

  • First video clip: Set type to first_clip to continue the video.

  • First video clip + last frame continuation: Set type to first_clip and last_frame to continue the first video while ensuring that the video's end state matches the last frame.

First video clip continuation

Input prompt

Input first video clip (2s)

Output video (12s, 10s continuation)

The baker brings over the brushed bread and sets the brush aside. The camera follows the baker to the oven in the back. The baker closes the oven door. He stands by the oven, watching the bread bake, smells the aroma, and says, "so good".

First video clip + last frame continuation

Input prompt

Input first video clip (2s)

Input last frame image

Output video (12s, 10s continuation)

A man looks down at a wooden box on the ground. He bends over and carefully opens the lid. He stares at the contents of the box, his lips trembling and slightly parted. His brow is furrowed and his eyes are wide with a look of horror.

wan2

Python SDK

Make sure that your DashScope Python SDK version is not lower than 1.25.16. For more information, see Install the SDK to update it.
# -*- coding: utf-8 -*-
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
import os

# The following URL is for the Singapore region. URLs vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/image-to-video-general-api-reference
dashscope.base_http_api_url = 'https://dashscope-intl.aliyuncs.com/api/v1'

# If you have not configured the environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
# API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
api_key = os.getenv("DASHSCOPE_API_KEY")

media = [
    {
        "type": "first_clip",
        "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/rptnhd/wan2.7-i2v-video-continuation-2.mp4"
    }
]

def sample_sync_call():
    print('----sync call, please wait a moment----')
    rsp = VideoSynthesis.call(
        api_key=api_key,
        model="wan2.7-i2v",
        media=media,
        resolution="720P",
        duration=12,
        watermark=True,
        prompt="The baker brings over the brushed bread and sets the brush aside. The camera follows the baker to the oven in the back. The baker closes the oven door. He stands by the oven, watching the bread bake, smells the aroma, and says, 'so good'.",
    )
    if rsp.status_code == HTTPStatus.OK:
        print(rsp.output.video_url)
    else:
        print('Failed, status_code: %s, code: %s, message: %s' %
              (rsp.status_code, rsp.code, rsp.message))


if __name__ == '__main__':
    sample_sync_call()

Java SDK

Make sure that your DashScope Java SDK version is not lower than 2.22.14. For more information, see Install the SDK to update it.
// Copyright (c) Alibaba, Inc. and its affiliates.

import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisParam;
import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisResult;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;

import java.util.ArrayList;
import java.util.List;

public class Image2Video {

    static {
        // The following URL is for the Singapore region. If you use a model in the China (Beijing) region, replace the URL with https://dashscope.aliyuncs.com/api/v1
        Constants.baseHttpApiUrl = "https://dashscope-intl.aliyuncs.com/api/v1";
    }

    // If you have not configured the environment variable, replace the following line with your Model Studio API key: apiKey="sk-xxx"
    // API keys vary by region. For more information, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
    static String apiKey = System.getenv("DASHSCOPE_API_KEY");

    public static void syncCall() {
        VideoSynthesis videoSynthesis = new VideoSynthesis();
        final String prompt = "The baker brings over the brushed bread and sets the brush aside. The camera follows the baker to the oven in the back. The baker closes the oven door. He stands by the oven, watching the bread bake, smells the aroma, and says, 'so good'.";
        List<VideoSynthesisParam.Media> media = new ArrayList<VideoSynthesisParam.Media>(){{
            add(VideoSynthesisParam.Media.builder()
                    .url("https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/rptnhd/wan2.7-i2v-video-continuation-2.mp4")
                    .type("first_clip")
                    .build());
        }};
        VideoSynthesisParam param =
                VideoSynthesisParam.builder()
                        .apiKey(apiKey)
                        .model("wan2.7-i2v")
                        .prompt(prompt)
                        .media(media)
                        .watermark(true)
                        .duration(12)
                        .resolution("720P")
                        .build();
        VideoSynthesisResult result = null;
        try {
            System.out.println("---sync call, please wait a moment----");
            result = videoSynthesis.call(param);
        } catch (ApiException | NoApiKeyException e){
            throw new RuntimeException(e.getMessage());
        } catch (InputRequiredException e) {
            throw new RuntimeException(e);
        }
        System.out.println(JsonUtils.toJson(result));
    }

    public static void main(String[] args) {
        syncCall();
    }
}

curl

Step 1: Create a task and obtain the task ID

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-i2v",
    "input": {
        "prompt": "The baker brings over the brushed bread and sets the brush aside. The camera follows the baker to the oven in the back. The baker closes the oven door. He stands by the oven, watching the bread bake, smells the aroma, and says, 'so good'.",
        "media": [
            {
                "type": "first_clip",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260414/rptnhd/wan2.7-i2v-video-continuation-2.mp4"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "duration": 12,
        "prompt_extend": false,
        "watermark": true
    }
}'

Step 2: Retrieve the result based on the task ID

Replace {task_id} with the task_id value returned by the previous API call. The task_id is valid for queries for 24 hours.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

How to input media

You can pass media through the media array. Each array element must specify a type and a url. Each type can appear at most once in the media array.

Note

Only the specific media combinations listed below are supported. If you pass any other combination, an error will occur.

First-frame video generation

// Combination 1: First frame, with automatic dubbing
{
  "media": [
    { "type": "first_frame", "url": "https://example.com/image.jpg" }
  ]
}

// Combination 2: First frame + driving audio, with custom audio
{
  "media": [
    { "type": "first_frame", "url": "https://example.com/image.jpg" },
    { "type": "driving_audio", "url": "https://example.com/audio.mp3" }
  ]
}

First-and-last-frame video generation

// Combination 1: First frame + last frame, with automatic dubbing
{
  "media": [
    { "type": "first_frame", "url": "https://example.com/image1.jpg" },
    { "type": "last_frame", "url": "https://example.com/image2.jpg" }
  ]
}

// Combination 2: First frame + last frame + driving audio, with custom audio
{
  "media": [
    { "type": "first_frame", "url": "https://example.com/image1.jpg" },
    { "type": "last_frame", "url": "https://example.com/image2.jpg" },
    { "type": "driving_audio", "url": "https://example.com/audio.mp3" }
  ]
}

Video continuation

// Combination 1: First video clip
{
  "media": [
    { "type": "first_clip", "url": "https://example.com/video.mp4" }
  ]
}

// Combination 2: First video clip + last frame
{
  "media": [
    { "type": "first_clip", "url": "https://example.com/video.mp4" },
    { "type": "last_frame", "url": "https://example.com/last_image.jpg" }
  ]
}

Input images

  • Number of images: You can pass a maximum of one image for the first frame (type=first_frame) and a maximum of one image for the last frame (type=last_frame).

  • Input methods:

    • Public URL: Supports the HTTP or HTTPS protocol. Example: https://xxxx/xxx.png.

    • Base64-encoded string: Use 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, 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

Input audio

  • Number of audio files: You can pass a maximum of one audio file (type=driving_audio).

  • Input methods:

    • Public URL: Supports the HTTP or HTTPS protocol. Example: https://xxxx/xxx.mp3.

Input videos

  • Number of videos: You can pass a maximum of one first video clip (type=first_clip).

  • Input methods:

    • Public URL: Supports the HTTP or HTTPS protocol. Example: https://xxxx/xxx.mp4.

Output video

  • Number of videos: 1.

  • Output video specifications: The supported output specifications vary by model. For more information, see Scope.

  • Output video URL validity: 24 hours.

  • Output video dimensions: The dimensions are determined by the input first frame or first video clip and the resolution setting.

    The model maintains the original aspect ratio of the input media (first frame image or first video clip). It scales the total number of pixels to a value close to the target specified by the resolution parameter and automatically adjusts the width and height to be integer multiples of 16.

Billing and rate limiting

  • For information about the free quota and unit price for the model, see Model pricing.

  • For information about rate limiting for the model, see Wanxiang series.

  • Billing details:

    • You are not charged for inputs. You are charged for outputs based on the duration in seconds of the successfully generated video.

    • Failed model calls or processing errors do not incur fees or consume the free quota for new users.

    • Image-to-video also supports savings plans.

API documentation

Wanxiang image-to-video 2.7 API reference

FAQ

Q: What are the differences between wan2.7-i2v and the wan2.6-i2v and earlier series models?

A: Compared with the wan2.6-i2v and earlier series models, the wan2.7-i2v model adds the following capabilities:

  • It supports three main tasks: first-frame video generation, first-and-last-frame video generation, and video continuation. Earlier models only supported first-frame video generation.

  • It uses the media array to pass multimodal media, such as images, audio, and videos. Earlier models only supported passing images through the img_url parameter.

Q: How do I create a multi-shot video with the wan2.7 model?

A: You can specify the shot structure in the prompt. The following methods are supported:

  • Direct specification: State "generate a multi-shot video" in the prompt.

  • Storyboards or timestamps: Describe each shot by time period. For example, "First shot, wide view, a boy raps and dances" or "First shot, wide view [1-5s], a boy raps and dances. Second shot, wide view [6-10s], camera cuts to the cheering audience".

  • If you do not explicitly specify the shot type, the model determines it based on the prompt content.

Q: Why can't I directly set the video aspect ratio, such as 16:9?

A: The current API does not support directly specifying the video aspect ratio. You can only set the video's resolution using the resolution parameter.

The resolution parameter controls the total number of pixels in the video, not a fixed aspect ratio. The model attempts to maintain the approximate original aspect ratio of the input first frame image or first video clip. It then makes minor adjustments to meet video encoding requirements, which state that both the width and height must be integer multiples of 16.