# Wan - image-to-video - first frame API reference (2.1-2.6)

> The Wan image-to-video model generates a smooth video from a first-frame image and a text prompt .

<strong>Related documents</strong>: [User guide](/help/en/model-studio/image-to-video-guide)

<Note>
  [Wan 2.7 - image-to-video](/help/en/model-studio/image-to-video-general-api-reference) supports first-frame-to-video, first-and-last-frame-to-video, and video continuation. <strong>We recommend this version</strong>.

  The [image-to-video (based on first frame)](/help/en/model-studio/legacy-image-to-video-api-reference) feature for Wan 2.6 and earlier models supports only first-frame-to-video.
</Note>

## Availability <span id="1fd78afa5brlj" /> <span id="09a068c6b1q5b" />

Your model, endpoint URL, and API key must be in the <strong>same region</strong>. Cross-region calls fail.

- [<strong>Select a model</strong>](/help/en/model-studio/image-to-video-guide#06f39eafa2dwt): Confirm the region where the model is available.
- <strong>Select a URL</strong>: Select the endpoint URL for the corresponding region. Both HTTP and DashScope SDK URLs are supported.
- <strong>Configure an API key</strong>: [Obtain an API key](/help/en/model-studio/get-api-key) for the region, and then [configure the API key in your environment variables](/help/en/model-studio/get-api-key).
- <strong>Install the SDK</strong>: To make calls with the SDK, [install the DashScope SDK](/help/en/model-studio/install-sdk).

<Note>
  The sample code in this topic is for the <strong>Singapore</strong> region.
</Note>

<Tip>
  Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. <strong>The new dedicated domains deliver superior performance and higher stability for inference requests</strong>. We recommend migrating to the new domains:

  - China (Beijing): from `https://dashscope.aliyuncs.com` to `https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com`
  - Singapore: from `https://dashscope-intl.aliyuncs.com` to `https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com`

  `{WorkspaceId}` is your workspace ID, which can be found on the <strong>Workspace Details</strong> page in the Alibaba Cloud Model Studio console. The existing domain remains fully functional.
</Tip>

## HTTP call <span id="42703589880ts" /> <span id="7c782df20fkq8" />

Image-to-video tasks use asynchronous invocation (typically 1–5 minutes): <strong>create task -> poll for results</strong>.

### Step 1: Create a task <span id="81185ac18blmj" /> <span id="fa69e36cd79fr" />

<Tabs>
  <Tab title="Singapore">
    `POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis`
  </Tab>

  <Tab title="Virginia">
    `POST https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis`
  </Tab>

  <Tab title="Beijing">
    `POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis`
  </Tab>

  <Tab title="Frankfurt">
    `POST https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis`
  </Tab>
</Tabs>

Replace `{WorkspaceId}` with your actual [workspace ID](/help/en/model-studio/regions#h2_migrate_domain).

<Note>
  - After the task is created, use the returned `task_id` to query the result. The `task_id` is valid for 24 hours. <strong>Do not create duplicate tasks</strong>. Instead, use polling to retrieve the result.
  - For guidance for beginners, see [Call APIs with Postman or cURL](/help/en/model-studio/first-call-to-image-and-video-api).
</Note>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td>
        #### Request parameters <span id="afcd41d2b57zf" />

        ##### Headers <span id="79473e45c592d" />

        <strong>Content-Type</strong> `string` <strong>(Required)</strong>

        The content type of the request. Must be `application/json`.

        <strong>Authorization</strong> `string` <strong>(Required)</strong>

        Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.

        <strong>X-DashScope-Async</strong> `string` <strong>(Required)</strong>

        Enables asynchronous processing. HTTP requests support only asynchronous calls. Must be `enable`.

        <Tip>
          If this request header is missing, the error "current user api does not support synchronous calls" is returned.
        </Tip>

        ##### Request body <span id="66a778d4fbfub" />

        <strong>model</strong> `string` <strong>(Required)</strong>

        The model name. Available models and pricing: [model pricing](/help/en/model-studio/model-pricing).

        Example: wan2.6-i2v-flash.

        <strong>input</strong> `object` <strong>(Required)</strong>

        Input fields including the prompt.

        <Accordion title="Properties" defaultOpen>
          <strong>prompt</strong> `string` (Optional)

          Describes the desired visual elements and characteristics of the generated video.

          Supports Chinese and English. Each character counts as one. Text exceeding the limit is truncated. Length limits by model:

          - Wan2.6 and Wan2.5 series models: A maximum of 1,500 characters.
          - wan2.2 and wan2.1 series models: A maximum of 800 characters.

          Example: A kitten running on the grass.

          Prompt writing tips: [Text-to-Video/Image-to-Video Prompt Guide](/help/en/model-studio/text-to-video-prompt).

          <strong>negative\_prompt</strong> `string` (Optional)

          Describes what to exclude from the video, constraining the output.

          Supports Chinese and English. Maximum 500 characters; longer text is truncated.

          Example: low resolution, errors, worst quality, low quality, disfigured, extra fingers, poor proportions, etc.

          <strong>img\_url</strong> `string` <strong>(Required)</strong>

          The URL or Base64-encoded data of the initial image.

          Image constraints:

          - Image format: JPEG, JPG, PNG (alpha channel not supported), BMP, or WEBP.
          - Image resolution: Both width and height must be within \[240, 8000] pixels.
          - File size:

            - Wan2.6 and Wan2.5 series models: A maximum of 20 MB.
            - wan2.2 and wan2.1 series models: A maximum of 10 MB.

          Supported input formats:

          1. Public URL:

             - Supports HTTP and HTTPS protocols.
             - Example: <a href="https://cdn.translate.alibaba.com/r/wanx-demo-1.png">[https://cdn.translate.alibaba.com/r/wanx-demo-1.png](https://cdn.translate.alibaba.com/r/wanx-demo-1.png)</a>.
          2. Base64-encoded image string:

             - Data format: `data:{MIME_type};base64,{base64_data}`.
             - Example: data:image/png;base64,GDU7MtCZzEbTbmRZ...... (truncated for brevity).
             - For details, see [Input Image](/help/en/model-studio/image-to-video-guide#32d9db99f1fk0).

          <strong>audio\_url</strong> `string` (Optional)

          <strong>Supported models: Wan2.6 and Wan2.5 series models.</strong>

          The URL of the audio file. The model generates the video using this audio.

          Supported input formats:

          1. Public URL:

             - Supports HTTP and HTTPS protocols.
             - Example: <a href="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp3">[https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp3](https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/xxx.mp3)</a>.

          Audio constraints:

          - Format: WAV, MP3.
          - Duration: 3–30s.
          - File size: A maximum of 15 MB.
          - Out-of-range handling: If the audio duration exceeds the specified `duration` (5 or 10 seconds), the system automatically truncates the audio to the first 5 or 10 seconds, and the rest is discarded. If the audio is shorter than the video duration, the video is silent after the audio ends. For example, if the audio is 3 seconds long and the video duration is 5 seconds, the first 3 seconds of the output video will have sound, and the last 2 seconds will be silent.

          Example: <a href="https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3">[https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3](https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3)</a>.
        </Accordion>

        <strong>parameters</strong> `object` (Optional)

        Controls for resolution, duration, intelligent prompt rewriting, and watermarks.

        <Accordion title="Properties" defaultOpen>
          <strong>resolution</strong> `string` (Optional)

          <Tip>
            Resolution directly affects cost. Before you call the API, confirm the [model pricing](/help/en/model-studio/model-pricing).
          </Tip>

          Specifies the output video resolution tier. The model scales the output to a similar total pixel count based on the selected tier. <strong>The model maintains the output aspect ratio as close as possible to that of the input image in</strong>`img_url`. For details, see [FAQ](/help/en/model-studio/legacy-image-to-video-api-reference#2b6ac4aea9h5n).

          The default value and available enum values for this parameter depend on the `model` parameter, as follows:

          - wan2.6-i2v-flash: Valid values: 720P, 1080P. Default value: `1080P`.
          - wan2.6-i2v: Valid values: 720P, 1080P. Default value: `1080P`.
          - wan2.6-i2v-us: Valid values: 720P, 1080P. Default value: `1080P`.
          - wan2.5-i2v-preview: Valid values: 480P, 720P, 1080P. Default value: `1080P`.
          - wan2.2-i2v-flash: Valid values: 480P, 720P. Default value: `720P`.
          - wan2.2-i2v-plus: Valid values: 480P, 1080P. Default value: `1080P`.
          - wan2.1-i2v-turbo: Valid values: 480P, 720P. Default value: `720P`.
          - wan2.1-i2v-plus: Valid values: 720P. Default value: `720P`.

          Example: 1080P.

          <strong>duration</strong> `integer` (Optional)

          <Tip>
            Duration directly affects cost. Before you call the API, confirm the [model pricing](/help/en/model-studio/model-pricing).
          </Tip>

          The output video duration, in seconds. Valid values depend on the `model` parameter:

          - wan2.6-i2v-flash: An integer in \[2, 15]. Default: 5.
          - wan2.6-i2v: An integer in \[2, 15]. Default: 5.
          - wan2.6-i2v-us: Valid values: 5, 10, 15. Default: 5.
          - wan2.5-i2v-preview: Valid values: 5, 10. Default: 5.
          - wan2.2-i2v-plus: Fixed at 5 seconds and cannot be modified.
          - wan2.2-i2v-flash: Fixed at 5 seconds and cannot be modified.
          - wan2.1-i2v-plus: Fixed at 5 seconds and cannot be modified.
          - wan2.1-i2v-turbo: Valid values: 3, 4, or 5. Default: 5.

          Example: 5.

          <strong>prompt\_extend</strong> `boolean` (Optional)

          Whether to enable prompt rewriting. When enabled, an LLM rewrites the input prompt. This improves generation quality for shorter prompts but increases processing time.

          - true (default)
          - false

          Example: true.

          <strong>shot\_type</strong> `string` (Optional)

          <strong>Supported models: Wan2.6 series models.</strong>

          Specifies the shot type of the generated video: a single continuous shot or a sequence of multiple shots.

          This parameter takes effect only when `"prompt_extend": true`.

          Parameter priority: `shot_type > prompt`. For example, if shot\_type is set to "single", even if the prompt contains "generate a multi-shot video", the model will still output a single-shot video.

          Valid values:

          - single: Default value. Generates a single-shot video.
          - multi: Generates a multi-shot video.

          Example: single.

          <Note>
            Use this parameter when you need strict control over the narrative structure, such as a single shot for product demos or multiple shots for short films.
          </Note>

          <strong>audio</strong> `boolean` (Optional)

          <Tip>
            This affects cost. Videos with sound and silent videos have different prices. Check pricing in the Model Studio console.
          </Tip>

          <strong>Supported model: wan2.6-i2v-flash.</strong>

          Specifies whether to generate a video with sound.

          Parameter priority: `audio > audio_url`. When `audio=false`, the output is still a silent video even if an `audio_url` is provided, and billing is based on a silent video.

          Valid values:

          - true: Default value. Generates a video with sound.
          - false: Generates a silent video.

          Example: true.

          <strong>watermark</strong> `boolean` (Optional)

          Specifies whether to add an "AI Generated" watermark in the lower-right corner of the video.

          - false: Default value. No watermark is added.
          - true: Adds a watermark.

          Example: false.

          <strong>seed</strong>`integer`(Optional)

          The random number seed. Value range: `[0, 2147483647]`.

          If not specified, the system generates one. For better reproducibility, use a fixed seed.

          Generation is probabilistic. Even with the same seed, results may differ.

          Example: 12345.
        </Accordion>
      </td>

      <td>
        <Tabs>
          <Tab title="Multi-shot narrative">
            This feature is supported only by the Wan2.6 series models.

            You can enable it by setting `"prompt_extend": true` and `"shot_type":"multi"`.

            ```bash
            # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.

            curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.6-i2v-flash",
                "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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
                    "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
                    "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
                },
                "parameters": {
                    "resolution": "720P",
                    "prompt_extend": true,
                    "duration": 10,
                    "shot_type":"multi"
                }
            }'
            ```
          </Tab>

          <Tab title="Automatic dubbing">
            This feature is supported only by the Wan2.6 and Wan2.5 series models.

            If you do not provide `input.audio_url`, the model automatically generates matching background music or sound effects based on the video content.

            ```bash
            # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.

            curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.5-i2v-preview",
                "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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
                    "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"
                },
                "parameters": {
                    "resolution": "480P",
                    "prompt_extend": true,
                    "duration": 10
                }
            }'
            ```
          </Tab>

          <Tab title="Custom audio">
            This feature is supported only by the Wan2.6 and Wan2.5 series models.

            To specify background music or a voiceover for the video, pass the URL of your custom audio file in the `input.audio_url` parameter.

            ```bash
            # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.

            curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.5-i2v-preview",
                "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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
                    "img_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
                    "audio_url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
                },
                "parameters": {
                    "resolution": "480P",
                    "prompt_extend": true,
                    "duration": 10
                }
            }'
            ```
          </Tab>

          <Tab title="Silent video">
            Only the following models support generating a silent video:

            - wan2.6-i2v-flash: To generate a silent video, <strong>you must explicitly set</strong> `parameters.audio = false`.
            - wan2.2 and wan2.1 series models: Generate silent videos by default; no additional parameters are required.

            ```bash
            # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.

            curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.2-i2v-plus",
                "input": {
                    "prompt": "A cat running on the grass",
                    "img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
                },
                "parameters": {
                    "resolution": "480P",
                    "prompt_extend": true
                }
            }'
            ```
          </Tab>

          <Tab title="Negative prompt">
            Use the negative\_prompt parameter to prevent "flowers" from appearing in the generated video.

            ```bash
            # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.

            curl --location 'https://{WorkspaceId}.ap-southeast-1.maas.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.2-i2v-plus",
                "input": {
                    "prompt": "A cat running on the grass",
                    "negative_prompt": "flowers",
                    "img_url": "https://cdn.translate.alibaba.com/r/wanx-demo-1.png"
                },
                "parameters": {
                    "resolution": "480P",
                    "prompt_extend": true
                }
            }'
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td>
        #### Response parameters <span id="cd3063363egdc" /> <span id="f5d1a44542v6q" />

        <strong>output</strong> `object`

        Information about the task output.

        <Accordion title="Properties" defaultOpen>
          <strong>task\_id</strong> `string`

          The task ID. Valid for queries for 24 hours.

          <strong>task\_status</strong> `string`

          The status of the task.

          <Accordion title="Enumeration values" defaultOpen>
            - PENDING
            - RUNNING
            - SUCCEEDED
            - FAILED
            - CANCELED
            - UNKNOWN: The task does not exist or its status is unknown.
          </Accordion>
        </Accordion>

        <strong>request\_id</strong> `string`

        Unique request identifier for tracing and troubleshooting.

        <strong>code</strong> `string`

        Error code. Returned only for failed requests. See [Error codes](/help/en/model-studio/error-code).

        <strong>message</strong> `string`

        Detailed error message. Returned only for failed requests. See [Error codes](/help/en/model-studio/error-code).
      </td>

      <td>
        <Tabs>
          <Tab title="Successful response">
            Save the `task_id` to query the task status and result.

            ```json
            {
                "output": {
                    "task_status": "PENDING",
                    "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
                },
                "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
            }
            ```
          </Tab>

          <Tab title="Error response">
            Task creation failed. See [Error codes](/help/en/model-studio/error-code).

            ```json
            {
                "code": "InvalidApiKey",
                "message": "Invalid API-key provided.",
                "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
            }
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

### Step 2: Query the task result <span id="420e6e77a17om" /> <span id="80128613c02kf" />

<Tabs>
  <Tab title="Singapore">
    `GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}`
  </Tab>

  <Tab title="Virginia">
    `GET https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1/tasks/{task_id}`
  </Tab>

  <Tab title="China (Beijing)">
    `GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}`
  </Tab>

  <Tab title="Frankfurt">
    `GET https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/tasks/{task_id}`
  </Tab>
</Tabs>

Replace `{WorkspaceId}` with your actual [workspace ID](/help/en/model-studio/regions#h2_migrate_domain).

<Note>
  - <strong>Polling recommendation</strong>: Video generation takes several minutes. Use a polling mechanism with a reasonable interval, such as 15 seconds.
  - <strong>Task state transition</strong>: PENDING → RUNNING → SUCCEEDED or FAILED.
  - <strong>Result link</strong>: After a task succeeds, a video URL valid for <strong>24 hours</strong> is returned. Download and save the video to permanent storage, such as [OSS](https://www.alibabacloud.com/help/en/doc-detail/31817.htm).
  - `task_id`<strong>validity</strong>: <strong>24 hours</strong>. After this period, queries return the task status as `UNKNOWN`.
</Note>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td>
        #### Request parameters <span id="a9e0408c70ylw" /> <span id="b43fdb7196o58" />

        ##### Headers <span id="2d2fb41da6idy" />

        <strong>Authorization</strong> `string` <strong>(Required)</strong>

        Authenticates the request with a Model Studio API key. Example: Bearer sk-xxxx.

        ##### Path parameters <span id="031d8a0fafqhp" />

        <strong>task\_id</strong> `string` <strong>(Required)</strong>

        The ID of the task.
      </td>

      <td>
        <Tabs>
          <Tab title="Query task result">
            Replace `{task_id}` with the `task_id` value returned by the previous API call. The `task_id` is valid for queries for 24 hours, Replace `{WorkspaceId}` with your actual [workspace ID](/help/en/model-studio/regions#h2_migrate_domain).

            ```bash
            curl -X GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id} \
            --header "Authorization: Bearer $DASHSCOPE_API_KEY"
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td>
        #### Response parameters <span id="810682d979i8q" /> <span id="209bb8b8c8976" />

        <strong>output</strong>`object`

        The output details of the task.

        <Accordion title="Properties" defaultOpen>
          <strong>task\_id</strong> `string`

          The task ID. Valid for queries for 24 hours.

          <strong>task\_status</strong> `string`

          The status of the task.

          <Accordion title="Enumeration values" defaultOpen>
            - PENDING
            - RUNNING
            - SUCCEEDED
            - FAILED
            - CANCELED
            - UNKNOWN: The task does not exist or its status is unknown.
          </Accordion>

          <strong>State transitions during polling:</strong>

          - PENDING → RUNNING → SUCCEEDED or FAILED.
          - The initial query status is usually PENDING or RUNNING.
          - When the status changes to SUCCEEDED, the response contains the generated video URL.
          - If the status is FAILED, check the error message and retry the task.

          <strong>submit\_time</strong> `string`

          The time when the task was submitted. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.

          <strong>scheduled\_time</strong> `string`

          The time when the task was executed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.

          <strong>end\_time</strong> `string`

          The time when the task was completed. The time is in UTC+8 and the format is YYYY-MM-DD HH:mm:ss.SSS.

          <strong>video\_url</strong> `string`

          URL of the generated video. Returned only when `task_status` is SUCCEEDED.

          Valid for 24 hours. The video is in MP4 format with H.264 encoding.

          <strong>orig\_prompt</strong> `string`

          The original input prompt, corresponding to the request parameter `prompt`.

          <strong>actual\_prompt</strong> `string`

          If `prompt_extend` is `true`, the system rewrites the prompt, and this field contains the optimized version.

          - If `prompt_extend=false`, this field is not returned.
          - Note: The wan2.6 model does not return this field, regardless of the value of `prompt_extend`.

          <strong>code</strong> `string`

          Error code. Returned only for failed requests. See [Error codes](/help/en/model-studio/error-code).

          <strong>message</strong> `string`

          Detailed error message. Returned only for failed requests. See [Error codes](/help/en/model-studio/error-code).
        </Accordion>

        <strong>usage</strong> `object`

        Usage statistics for the task, which are counted only for successful tasks.

        <Accordion title="Properties" defaultOpen>
          <Accordion title="Parameters returned by wan2.6 series models" defaultOpen>
            <strong>input\_video\_duration</strong> `integer`

            The duration of the input video in seconds. This is always 0, as video input is not currently supported.

            <strong>output\_video\_duration</strong> `integer`

            Returned only when using wan2.6 models.

            The duration of the output video in seconds. This value matches the `input.duration`.

            <strong>duration</strong> `integer`

            The total video duration, used for billing.

            Billing formula: `duration=input_video_duration+output_video_duration`.

            <strong>SR</strong> `integer`

            Returned only when using wan2.6 models. The resolution tier of the generated video. Example: 720.

            <strong>video\_count</strong> `integer`

            The number of generated videos. This is fixed at 1.

            <strong>audio</strong>`boolean`

            Returned only when using the wan2.6-i2v-flash model. Indicates whether the output is a video with audio.
          </Accordion>

          <Accordion title="Parameters returned by wan2.2 and wan2.5 series models">
            <strong>duration</strong> `integer`

            The duration of the generated video in seconds. Possible values: 5, 10.

            Billing formula: Cost = Video duration in seconds × Unit price.

            <strong>SR</strong> `integer`

            The resolution of the generated video. Possible values: 480, 720, 1080.

            <strong>video\_count</strong> `integer`

            The number of generated videos. This is fixed at 1.
          </Accordion>

          <Accordion title="Parameters returned by wan2.1 series models">
            <strong>video\_duration</strong> `integer`

            The duration of the generated video in seconds. Possible values: 3, 4, 5.

            Billing formula: Cost = Video duration in seconds × Unit price.

            <strong>video\_ratio</strong> `string`

            The aspect ratio of the generated video. This value is always "standard".

            <strong>video\_count</strong> `integer`

            The number of generated videos. This is fixed at 1.
          </Accordion>
        </Accordion>

        <strong>request\_id</strong> `string`

        Unique request identifier for tracing and troubleshooting.
      </td>

      <td>
        <Tabs>
          <Tab title="Task succeeded">
            Video URLs are valid for only 24 hours and then automatically purged. Save generated videos promptly.

            ```json
            {
                "request_id": "2ca1c497-f9e0-449d-9a3f-xxxxxx",
                "output": {
                    "task_id": "af6efbc0-4bef-4194-8246-xxxxxx",
                    "task_status": "SUCCEEDED",
                    "submit_time": "2025-09-25 11:07:28.590",
                    "scheduled_time": "2025-09-25 11:07:35.349",
                    "end_time": "2025-09-25 11:17:11.650",
                    "orig_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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
                    "video_url": "https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.mp4?Expires=xxx"
                },
                "usage": {
                    "duration": 10,
                    "input_video_duration": 0,
                    "output_video_duration": 10,
                    "video_count": 1,
                    "SR": 720
                }
            }
            ```
          </Tab>

          <Tab title="Task failed">
            When a task fails, `task_status` is FAILED with an error code and message. See [Error codes](/help/en/model-studio/error-code).

            ```json
            {
                "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
                "output": {
                    "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
                    "task_status": "FAILED",
                    "code": "InvalidParameter",
                    "message": "The size is not match xxxxxx"
                }
            }
            ```
          </Tab>

          <Tab title="Task query expired">
            The `task_id` is valid for 24 hours. After this period, queries return the following error.

            ```json
            {
                "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
                "output": {
                    "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
                    "task_status": "UNKNOWN"
                }
            }
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

## DashScope SDK calls <span id="db17b3098c2iv" /> <span id="41ca556e17lbx" />

SDK parameter names are largely consistent with the [HTTP API](/help/en/model-studio/legacy-image-to-video-api-reference#42703589880ts), following each language's conventions.

Image-to-video tasks typically take 1–5 minutes. The SDK wraps the asynchronous HTTP call process and supports both synchronous and asynchronous calls.

> Processing time depends on the task queue and service status.

### Python SDK <span id="a3ad9a3b6d9if" /> <span id="cf97f2c7e50cg" />

<Tip>
  Make sure your DashScope Python SDK version is <strong>at least</strong>`1.25.8` before running the following code.

  Older versions might trigger errors such as "url error, please check url!". To update, refer to [Install the SDK](/help/en/model-studio/install-sdk).
</Tip>

Set the `base_http_api_url` according to the model's region:

<Tabs>
  <Tab title="Singapore">
    `dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'`
  </Tab>

  <Tab title="Virginia">
    `dashscope.base_http_api_url = 'https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1'`
  </Tab>

  <Tab title="Beijing">
    `dashscope.base_http_api_url = 'https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1'`
  </Tab>

  <Tab title="Frankfurt">
    `dashscope.base_http_api_url = 'https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1'`
  </Tab>
</Tabs>

Replace `{WorkspaceId}` with your actual [workspace ID](/help/en/model-studio/regions#h2_migrate_domain).

#### Sample code <span id="f2b1639e488og" /> <span id="b04667a06ed3d" />

<Tabs>
  <Tab title="Synchronous call">
    A synchronous call blocks until video generation completes. This example demonstrates three image input methods: public URL, Base64 encoding, and local file path.

    ##### Request example <span id="98834049b6p8l" /> <span id="33f9a763cd80s" />

    ```python expandable
    import base64
    import os
    from http import HTTPStatus
    from dashscope import VideoSynthesis
    import mimetypes
    import dashscope

    # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.
    dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

    # If the environment variable is not set, replace the following line with your API key from Model Studio: api_key="sk-xxx"
    # Get your API key: https://www.alibabacloud.com/help/model-studio/get-api-key
    api_key = os.getenv("DASHSCOPE_API_KEY")

    # --- Helper function for Base64 encoding ---
    # Format: data:{MIME_type};base64,{base64_data}
    def encode_file(file_path):
        mime_type, _ = mimetypes.guess_type(file_path)
        if not mime_type or not mime_type.startswith("image/"):
            raise ValueError("Unsupported or unrecognized image format")
        with open(file_path, "rb") as image_file:
            encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
        return f"data:{mime_type};base64,{encoded_string}"

    """
    Image input methods:
    The following are three ways to provide an image. Choose one.

    1. Public URL: Ideal for images that are already publicly accessible.
    2. Local file: Suitable for local development and testing.
    3. Base64 encoding: Best for private images or when data must be securely transmitted.
    """

    # [Method 1] Use a publicly accessible image URL
    # Example: Use a public image URL
    img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"

    # [Method 2] Use a local file (supports absolute and relative paths)
    # Format: file:// + file path
    # Example (absolute path):
    # img_url = "file://" + "/path/to/your/img.png"    # Linux/macOS
    # img_url = "file://" + "C:/path/to/your/img.png"  # Windows
    # Example (relative path):
    # img_url = "file://" + "./img.png"                # Relative to the current script's directory

    # [Method 3] Use a Base64-encoded image
    # img_url = encode_file("./img.png")

    # Set the audio URL
    audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"

    def sample_call_i2v():
        # A synchronous call returns the result directly.
        print('please wait...')
        rsp = VideoSynthesis.call(api_key=api_key,
                                  model='wan2.6-i2v-flash',
                                  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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.',
                                  img_url=img_url,
                                  audio_url=audio_url,
                                  resolution="720P",
                                  duration=10,
                                  prompt_extend=True,
                                  watermark=False,
                                  negative_prompt="",
                                  seed=12345)
        print(rsp)
        if rsp.status_code == HTTPStatus.OK:
            print("video_url:", 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_call_i2v()
    ```

    ##### Response example <span id="818467b02dzvx" />

    > The video\_url is valid for 24 hours. Download the video before it expires.

    ```json
    {
        "status_code": 200,
        "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
        "code": null,
        "message": "",
        "output": {
            "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
            "submit_time": "2026-01-22 23:24:46.527",
            "scheduled_time": "2026-01-22 23:24:46.565",
            "end_time": "2026-01-22 23:25:59.978",
            "orig_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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise."
        },
        "usage": {
            "video_count": 1,
            "video_duration": 0,
            "video_ratio": "",
            "duration": 10,
            "input_video_duration": 0,
            "output_video_duration": 10,
            "audio": true,
            "SR": 720
        }
    }
    ```
  </Tab>

  <Tab title="Asynchronous call">
    An asynchronous call immediately returns a task ID. You then poll for the result or wait for completion.

    ##### Request example <span id="b047752bac2fz" /> <span id="6903511374pcv" />

    ```python expandable
    import os
    from http import HTTPStatus
    from dashscope import VideoSynthesis
    import dashscope

    # The following URL is for the Singapore region. Replace {WorkspaceId} with your actual workspace ID. URLs differ by region.
    dashscope.base_http_api_url = 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1'

    # If the environment variable is not set, replace the following line with your API key from Model Studio: api_key="sk-xxx"
    # Get your API key: https://www.alibabacloud.com/help/model-studio/get-api-key
    api_key = os.getenv("DASHSCOPE_API_KEY")

    # Use a publicly accessible image URL
    img_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png"

    # Set the audio URL
    audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"

    def sample_async_call_i2v():
        # Asynchronous call, returns a task ID
        rsp = VideoSynthesis.async_call(api_key=api_key,
                                        model='wan2.6-i2v-flash',
                                        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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.',
                                        img_url=img_url,
                                        audio_url=audio_url,
                                        resolution="720P",
                                        duration=10,
                                        prompt_extend=True,
                                        watermark=False,
                                        negative_prompt="",
                                        seed=12345)
        print(rsp)
        if rsp.status_code == HTTPStatus.OK:
            print("task_id: %s" % rsp.output.task_id)
        else:
            print('Failed, status_code: %s, code: %s, message: %s' %
                  (rsp.status_code, rsp.code, rsp.message))

        # Get the status of the asynchronous task
        status = VideoSynthesis.fetch(task=rsp, api_key=api_key)
        if status.status_code == HTTPStatus.OK:
            print(status.output.task_status)
        else:
            print('Failed, status_code: %s, code: %s, message: %s' %
                  (status.status_code, status.code, status.message))

        # Wait for the asynchronous task to complete
        rsp = VideoSynthesis.wait(task=rsp, api_key=api_key)
        print(rsp)
        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_async_call_i2v()
    ```

    ##### Response example <span id="15a0d419b9q5r" />

    1. Task creation response

    ```json
    {
        "status_code": 200,
        "request_id": "6dc3bf6c-be18-9268-9c27-xxxxxx",
        "code": "",
        "message": "",
        "output": {
            "task_id": "686391d9-7ecf-4290-a8e9-xxxxxx",
            "task_status": "PENDING",
            "video_url": ""
        },
        "usage": null
    }
    ```

    2. Task query response

    > The video\_url is valid for 24 hours. Download the video before it expires.

    ```json
    {
        "status_code": 200,
        "request_id": "2794c7a3-fe8c-4dd4-a1b7-xxxxxx",
        "code": null,
        "message": "",
        "output": {
            "task_id": "c15d5b14-07c4-4af5-b862-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
            "submit_time": "2026-01-22 23:24:46.527",
            "scheduled_time": "2026-01-22 23:24:46.565",
            "end_time": "2026-01-22 23:25:59.978",
            "orig_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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise."
        },
        "usage": {
            "video_count": 1,
            "video_duration": 0,
            "video_ratio": "",
            "duration": 10,
            "input_video_duration": 0,
            "output_video_duration": 10,
            "audio": true,
            "SR": 720
        }
    }
    ```
  </Tab>
</Tabs>

### Java SDK <span id="589b80853e6rn" /> <span id="0910550f7e6es" />

<Tip>
  Make sure your DashScope Java SDK version is <strong>at least</strong>`2.22.6` before running the following code.

  Older versions might trigger errors such as "url error, please check url!". To update, refer to [Install the SDK](/help/en/model-studio/install-sdk).
</Tip>

Set the `baseHttpApiUrl` according to the model's region:

<Tabs>
  <Tab title="Singapore">
    `Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";`
  </Tab>

  <Tab title="Virginia">
    `Constants.baseHttpApiUrl = "https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/api/v1";`
  </Tab>

  <Tab title="Beijing">
    `Constants.baseHttpApiUrl = "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1";`
  </Tab>

  <Tab title="Frankfurt">
    `Constants.baseHttpApiUrl = "https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1";`
  </Tab>
</Tabs>

Replace `{WorkspaceId}` with your actual [workspace ID](/help/en/model-studio/regions#h2_migrate_domain).

#### Sample code <span id="ae42e9ea5chzu" /> <span id="fabb5a6cf8y2e" />

<Tabs>
  <Tab title="Synchronous call">
    A synchronous call blocks until video generation completes. This example demonstrates three image input methods: public URL, Base64 encoding, and local file path.

    ##### Request example <span id="3e3609efb9rhl" /> <span id="e32ffd6888esr" />

    ```java expandable
    // 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.JsonUtils;
    import com.alibaba.dashscope.utils.Constants;

    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    import java.util.Base64;
    import java.util.HashMap;
    import java.util.Map;

    public class Image2Video {

        static {
            // Set the endpoint. This example uses the Singapore region. For other regions, see: https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference
            Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
        }

        // If the environment variable is not set, replace the following line with your API key from Model Studio: apiKey="sk-xxx"
        // Get your API key: https://www.alibabacloud.com/help/model-studio/get-api-key
        static String apiKey = System.getenv("DASHSCOPE_API_KEY");

        /**
         * Image input methods: Choose one of the following three.
         *
         * 1. Public URL: Ideal for images that are already publicly accessible.
         * 2. Local file: Suitable for local development and testing.
         * 3. Base64 encoding: Best for private images or when data must be securely transmitted.
         */

        // [Method 1] Public URL
        static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";

        // [Method 2] Local file path (file:// + absolute path)
        // static String imgUrl = "file://" + "/your/path/to/img.png";    // Linux/macOS
        // static String imgUrl = "file://" + "C:/your/path/to/img.png";  // Windows

        // [Method 3] Base64 encoding
        // static String imgUrl = Image2Video.encodeFile("/your/path/to/img.png");

        // Set the audio URL
        static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";

        public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
            // Set the parameters
            Map<String, Object> parameters = new HashMap<>();
            parameters.put("prompt_extend", true);
            parameters.put("watermark", false);
            parameters.put("seed", 12345);

            VideoSynthesis vs = new VideoSynthesis();
            VideoSynthesisParam param =
                    VideoSynthesisParam.builder()
                            .apiKey(apiKey)
                            .model("wan2.6-i2v-flash")
                            .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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.")
                            .imgUrl(imgUrl)
                            .audioUrl(audioUrl)
                            .duration(10)
                            .parameters(parameters)
                            .resolution("720P")
                            .negativePrompt("")
                            .build();
            System.out.println("please wait...");
            VideoSynthesisResult result = vs.call(param);
            System.out.println(JsonUtils.toJson(result));
        }

         /**
         * Encodes a file into a Base64 string.
         * @param filePath The file path.
         * @return A Base64 string in the format data:{MIME_type};base64,{base64_data}.
         */
        public static String encodeFile(String filePath) {
            Path path = Paths.get(filePath);
            if (!Files.exists(path)) {
                throw new IllegalArgumentException("File does not exist: " + filePath);
            }
            // Detect MIME type
            String mimeType = null;
            try {
                mimeType = Files.probeContentType(path);
            } catch (IOException e) {
                throw new IllegalArgumentException("Cannot detect file type: " + filePath);
            }
            if (mimeType == null || !mimeType.startsWith("image/")) {
                throw new IllegalArgumentException("Unsupported or unrecognized image format");
            }
            // Read file content and encode
            byte[] fileBytes = null;
            try{
                fileBytes = Files.readAllBytes(path);
            } catch (IOException e) {
                throw new IllegalArgumentException("Cannot read file content: " + filePath);
            }

            String encodedString = Base64.getEncoder().encodeToString(fileBytes);
            return "data:" + mimeType + ";base64," + encodedString;
        }

        public static void main(String[] args) {
            try {
                image2video();
            } catch (ApiException | NoApiKeyException | InputRequiredException e) {
                System.out.println(e.getMessage());
            }
            System.exit(0);
        }
    }
    ```

    ##### Response example <span id="dfe6c9cc786iy" />

    > The video\_url is valid for 24 hours. Download the video before it expires.

    ```json
    {
        "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
        "output": {
            "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
            "orig_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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
            "submit_time": "2026-01-22 23:25:45.729",
            "scheduled_time": "2026-01-22 23:25:45.771",
            "end_time": "2026-01-22 23:26:44.942"
        },
        "usage": {
            "video_count": 1,
            "duration": 10.0,
            "input_video_duration": 0.0,
            "output_video_duration": 10.0,
            "SR": "720"
        },
        "status_code": 200,
        "code": "",
        "message": ""
    }
    ```
  </Tab>

  <Tab title="Asynchronous call">
    An asynchronous call immediately returns a task ID. You then poll for the result or wait for completion.

    ##### Request example <span id="2fc30f223b9py" /> <span id="5b5e9e31ecl3l" />

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

    import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesis;
    import com.alibaba.dashscope.aigc.videosynthesis.VideoSynthesisListResult;
    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.task.AsyncTaskListParam;
    import com.alibaba.dashscope.utils.JsonUtils;
    import com.alibaba.dashscope.utils.Constants;

    import java.util.HashMap;
    import java.util.Map;

    public class Image2Video {

        static {
            // Set the endpoint. This example uses the Singapore region. For other regions, see: https://www.alibabacloud.com/help/model-studio/image-to-video-api-reference
            Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
        }

        // If the environment variable is not set, replace the following line with your API key from Model Studio: apiKey="sk-xxx"
        // Get your API key: https://www.alibabacloud.com/help/model-studio/get-api-key
        static String apiKey = System.getenv("DASHSCOPE_API_KEY");
        // Set the input image URL
        static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";

        // Set the audio URL
        static String audioUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3";

        public static void image2video() throws ApiException, NoApiKeyException, InputRequiredException {
            // Set the parameters
            Map<String, Object> parameters = new HashMap<>();
            parameters.put("prompt_extend", true);
            parameters.put("watermark", false);
            parameters.put("seed", 12345);

            VideoSynthesis vs = new VideoSynthesis();
            VideoSynthesisParam param =
                    VideoSynthesisParam.builder()
                            .apiKey(apiKey)
                            .model("wan2.6-i2v-flash")
                            .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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.")
                            .imgUrl(imgUrl)
                            .audioUrl(audioUrl)
                            .duration(10)
                            .parameters(parameters)
                            .resolution("720P")
                            .negativePrompt("")
                            .build();
            // Asynchronous call
            VideoSynthesisResult task = vs.asyncCall(param);
            System.out.println(JsonUtils.toJson(task));
            System.out.println("please wait...");

            // Get the result
            VideoSynthesisResult result = vs.wait(task, apiKey);
            System.out.println(JsonUtils.toJson(result));
        }

        // Get the task list
        public static void listTask() throws ApiException, NoApiKeyException {
            VideoSynthesis is = new VideoSynthesis();
            AsyncTaskListParam param = AsyncTaskListParam.builder().build();
            param.setApiKey(apiKey);
            VideoSynthesisListResult result = is.list(param);
            System.out.println(result);
        }

        // Get the result of a single task
        public static void fetchTask(String taskId) throws ApiException, NoApiKeyException {
            VideoSynthesis is = new VideoSynthesis();
            // If DASHSCOPE_API_KEY is set as an environment variable, apiKey can be null.
            VideoSynthesisResult result = is.fetch(taskId, apiKey);
            System.out.println(result.getOutput());
            System.out.println(result.getUsage());
        }

        public static void main(String[] args) {
            try {
                image2video();
            } catch (ApiException | NoApiKeyException | InputRequiredException e) {
                System.out.println(e.getMessage());
            }
            System.exit(0);
        }
    }
    ```

    ##### Response example <span id="38e1e3c7303rm" />

    1. Task creation response

    ```json
    {
        "request_id": "5dbf9dc5-4f4c-9605-85ea-xxxxxxxx",
        "output": {
            "task_id": "7277e20e-aa01-4709-xxxxxxxx",
            "task_status": "PENDING"
        }
    }
    ```

    2. Task query response

    > The video\_url is valid for 24 hours. Download the video before it expires.

    ```json
    {
        "request_id": "87c091bb-7a3c-4904-8501-xxxxxx",
        "output": {
            "task_id": "413ed6e4-5f3a-4f57-8d58-xxxxxx",
            "task_status": "SUCCEEDED",
            "video_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxx.mp4?Expires=xxx",
            "orig_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 under an urban railway bridge at night. The lighting 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 his rap, with no other dialogue or noise.",
            "submit_time": "2026-01-22 23:25:45.729",
            "scheduled_time": "2026-01-22 23:25:45.771",
            "end_time": "2026-01-22 23:26:44.942"
        },
        "usage": {
            "video_count": 1,
            "duration": 10.0,
            "input_video_duration": 0.0,
            "output_video_duration": 10.0,
            "SR": "720"
        },
        "status_code": 200,
        "code": "",
        "message": ""
    }
    ```
  </Tab>
</Tabs>

## Limitations <span id="445b4bb8acqle" /> <span id="3e28930521g0y" />

- <strong>Data retention</strong>: The `task_id` and video URL are retained for 24 hours. After this period, you cannot query or download them.
- <strong>Content moderation</strong>: All inputs (prompts, images) and output videos are subject to content moderation. Violations result in an `IPInfringementSuspect` or `DataInspectionFailed` error. [Error codes](/help/en/model-studio/error-code).

## Known limitations <span id="h2-known-limitations" /> <span id="known-limitations" />

When wan2.6-i2v-flash generates continuous rotation of a circular object (such as a ring, gear, or clock dial), the video may stall for about 1 second at around the 3-second mark. To avoid this issue, use the [Wan 2.7 - image-to-video](/help/en/model-studio/image-to-video-general-api-reference) model instead.

## Error codes <span id="0d0a562d05nkh" /> <span id="2e1d8db361w9w" />

If a model call returns an error message, see [Error codes](/help/en/model-studio/error-code).

## FAQ <span id="2b6ac4aea9h5n" /> <span id="a3cf03d10dq3j" />

#### Q: How to generate a video with a specific aspect ratio? <span id="646b718e448ww" /> <span id="aff1652b5a62n" />

<strong>A:</strong> The <strong>input first-frame image (img\_url)</strong> determines the aspect ratio of the output video. However, an <strong>exact ratio</strong> like 3:4 is not guaranteed, as minor deviations may occur.

- <strong>Why do deviations occur?</strong>

  The model uses the input image's aspect ratio as a baseline and combines it with the total pixel count of the selected resolution tier (`resolution`) to calculate the closest valid resolution. Because a video's width and height must be multiples of 16, the model adjusts the final resolution accordingly. As a result, the output aspect ratio is not guaranteed to be exactly 3:4, but it will be very close.

  - For example, an input image of 750×1000 (aspect ratio 3:4 = 0.75) with `resolution` set to "720P" (a target of approximately 920,000 total pixels) produces an output of 816×1104 (aspect ratio ≈ 0.739, approximately 900,000 total pixels).
- <strong>Recommendations</strong>:

  - <strong>Control the input</strong>: For best results, use a first-frame image that already has your target aspect ratio.
  - <strong>Post-processing</strong>: If you need a strict aspect ratio, crop the video or add black bars using an editing tool after generation.

#### Q: How to get the video storage domain allowlist? <span id="c7421e6e32dj8" /> <span id="03e78329f3mo2" />

A: Videos generated by models are stored in OSS. The API returns a temporary public URL. <strong>To configure a firewall whitelist for this download URL</strong>, 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.