Vidu - Image-to-video from an initial frame API reference

Updated at:

The Vidu image-to-video model generates a smooth video from an input image and a text prompt .

ImportantThis document applies only to the China (Beijing) region. Use an API key from this region.

Activate the service

Go to the Alibaba Cloud Model Studio console, search for Vidu, find the Vidu model card, and click Activate Now. In the dialog box that appears, confirm the activation and authorization.

Scope

The model, Endpoint URL, and API Key must belong to the same region. Cross-region calls will fail.

HTTP calls

Image-to-video generation is a long-running task that typically takes 1 to 5 minutes, so the API uses an asynchronous model. The workflow consists of two core steps: create a task, then poll for the result.

Step 1: Create a task

China (Beijing) region: POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Note

  • After the task is successfully created, use the task_id returned by the interface to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks; use polling to obtain the results.

Request parameters

Headers

Content-Type string (Required)

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

Content-Type string (Required)

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

X-DashScope-Async string (Required)

Asynchronous processing configuration parameter. HTTP requests support asynchronous mode only, and it must be set to enable.

ImportantIf this request header is missing, the error "current user api does not support synchronous calls" is returned.

Request body

model string (Required)

The name of the model. Valid values are:

  • vidu/viduq3-pro-fast_img2video
  • vidu/viduq3-pro_img2video
  • vidu/viduq3-turbo_img2video
  • vidu/viduq2-pro-fast_img2video
  • vidu/viduq2-pro_img2video
  • vidu/viduq2-turbo_img2video

input object (Required)

The basic input, including the text prompt and media assets.

Properties

prompt string (Optional)

The text prompt, which describes the desired elements and visual characteristics of the generated video.

The maximum length is 5,000 characters (both Chinese characters and English letters count as one). Text exceeding this limit is truncated.

For more information about how to write prompts, see Vidu Video Generation Prompt Guide.

media array (Required)

A list of media assets specifying the image for generation.

Each element in the array is a media object containing a type field and a url field.

Properties

type string (Required)

The type of the media asset. This must be set to the following fixed value:

  • image: An image URL.

Asset limitation: You must provide exactly one image asset.

url string (Required)

The URL of the image file, which must be publicly accessible.

Image constraints:

  • Formats: JPG, JPEG, PNG, WEBP.
  • Aspect ratio: 1:4 to 4:1.
  • File size: Up to 50 MB.

parameters object (Optional)

Parameters for video processing, such as resolution and duration.

Properties

resolution string (Optional)

Importantresolution directly affects the cost. Confirm the model price before calling.

Specifies the resolution tier for the generated video.

The model scales the video to a pixel count that approximates the selected tier while preserving the input image's aspect ratio.

  • vidu/viduq3-pro-fast_img2video: Valid values: 720P, 1080P. Default value: 720P.
  • vidu/viduq3-pro_img2video: Valid values: 540P, 720P, 1080P. Default value: 720P.
  • vidu/viduq3-turbo_img2video: Valid values: 540P, 720P, 1080P. Default value: 720P.
  • vidu/viduq2-pro-fast_img2video: Valid values: 720P, 1080P. Default value: 720P.
  • vidu/viduq2-pro_img2video: Valid values: 540P, 720P, 1080P. Default value: 720P.
  • vidu/viduq2-turbo_img2video: Valid values: 540P, 720P, 1080P. Default value: 720P.

duration integer (Optional)

Importantduration directly affects the cost. Billing is based on seconds: the longer the duration, the higher the cost. Confirm the model price before calling.

The duration of the generated video in seconds.

  • vidu/viduq3-pro-fast_img2video: An integer in the range [1, 16]. Default value is 5.
  • vidu/viduq3-pro_img2video: An integer in the range [1, 16]. Default value is 5.
  • vidu/viduq3-turbo_img2video: An integer in the range [1, 16]. Default value is 5.
  • vidu/viduq2-pro-fast_img2video: An integer in the range [1, 10]. Default value is 5.
  • vidu/viduq2-pro_img2video: An integer in the range [1, 10]. Default value is 5.
  • vidu/viduq2-turbo_img2video: An integer in the range [1, 10]. Default value is 5.

audio boolean (Optional)

Supported models: vidu/viduq3-pro-fast_img2video, vidu/viduq3-pro_img2video, vidu/viduq3-turbo_img2video.

Specifies whether to generate a video with audio. If enabled, the model automatically generates matching background music or sound effects based on the video content.

  • false: (Default) Outputs a silent video.
  • true: Outputs a video with audio.

watermark boolean (Optional)

Specifies whether to add a watermark. The watermark is placed in the bottom-right corner of the video and contains the fixed text "Generated by AI".

  • false: (Default) No watermark is added.
  • true: A watermark is added.

seed integer (Optional)

The random number seed must be an integer in the range [0, 2147483647].

If not specified, a random seed is generated. A fixed seed improves reproducibility.

Because model generation is probabilistic, the same seed does not guarantee identical results.

Image-to-video

curl --location 'https://{WorkspaceId}.cn-beijing.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": "vidu/viduq3-pro-fast_img2video",
    "input": {
        "media": [
            {
                "type": "image",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp"
            }
        ],
        "prompt": "镜头从海龟下方缓缓上移,海龟悠然游动,腹部细节清晰可见。"
    },
    "parameters": {
        "duration": 5,
        "resolution": "720P",
        "watermark": true
    }
}'

Python SDK

import dashscope
import os
from dashscope import DashScopeError

# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://help.aliyun.com/zh/model-studio/get-api-key
client = dashscope.Client(api_key=os.getenv("DASHSCOPE_API_KEY"))

media = [{'type': 'image', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260121/zlpocv/wan-i2v-haigui.webp'}]

def sample_async_call():
    # 异步提交视频生成任务
    try:
        job = client.videos.jobs.create(model='vidu/viduq3-pro-fast_img2video',
                                        media=media,
                                        prompt='镜头从海龟下方缓缓上移,海龟悠然游动,腹部细节清晰可见。',
                                        duration=5,
                                        resolution='720P',
                                        watermark=True)
        print(job)
        print("task_id: %s" % job.task_id)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")
        return

    # 查询任务状态
    try:
        snapshot = client.videos.jobs.fetch(job.task_id)
        print(snapshot.status)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")

    # 等待任务完成
    try:
        done = client.videos.jobs.wait(job)
        print(done)
        print(done.video_url)
    except DashScopeError as e:
        print(f"HTTP返回码:{e.status_code}")
        print(f"错误码:{e.code}")
        print(f"错误信息:{e.message}")
        print("请参考文档:https://help.aliyun.com/zh/model-studio/developer-reference/error-code")

if __name__ == '__main__':
    sample_async_call()

Response parameters

output object

Task output information.

Properties

task_id string

The task ID. Valid for queries for 24 hours.

task_status string

The status of the task.

Enumeration values

  • PENDING: The task is queued.
  • RUNNING: The task is being processed.
  • SUCCEEDED: The task completed successfully.
  • FAILED: The task failed.
  • CANCELED: The task was canceled.
  • UNKNOWN: The task does not exist or its status is unknown.

request_idstring

Unique request identifier for tracing and troubleshooting.

codestring

Error code. Returned only for failed requests. See Error codes.

messagestring

Detailed error message. Returned only for failed requests. See Error codes.

Successful response

Save the task_id, which is used to query the task status and results.

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

Error response

Task creation failed. See Error codes.

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

Step 2: Query the result

China (Beijing) region: GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id}

Note

  • Polling recommendation: Video generation takes several minutes. We recommend using a polling mechanism with a reasonable query interval (such as 15 seconds) to obtain the results.
  • Task status transitions: PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • task_id validity: 24 hours. After it expires, the result can no longer be queried, and the interface will return a task status of UNKNOWN.
  • RPS limit: The default RPS of the query interface is 20. For higher-frequency queries or event notifications, we recommend configuring asynchronous task callbacks.
  • More operations: For batch queries, task cancellation, and other operations, see Managing asynchronous tasks.

Request parameters

Headers

Authorization string (Required)

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

Path parameters

task_id string (Required)

The ID of the task.

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

curl -X GET https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"

Response parameters

outputobject

Task output information.

Properties

task_id string

The task ID. Valid for queries for 24 hours.

task_status string

The status of the task.

Enumeration values

  • PENDING: The task is queued.
  • RUNNING: The task is being processed.
  • SUCCEEDED: The task completed successfully.
  • FAILED: The task failed.
  • CANCELED: The task was canceled.
  • UNKNOWN: The task does not exist or its status is unknown.
State transitions during polling:
  • PENDING (Queuing) → RUNNING (Processing) → SUCCEEDED (Success) / FAILED (Failed).
  • The status on the first query is usually PENDING (Queuing) or RUNNING (Processing).
  • When the status changes to SUCCEEDED, the response will contain the URL of the generated video.
  • If the status is FAILED, check the error message and retry.
  • If the status is CANCELED, the task has been canceled. To continue, submit the task again.
  • If the status is UNKNOWN, the task does not exist or its status is unknown. This may occur when the task_id does not exist or the 24-hour validity period has expired.

submit_time string

The time when the task was submitted. format is YYYY-MM-DD HH:mm:ss.SSS.

scheduled_time string

The time when the task was executed. format is YYYY-MM-DD HH:mm:ss.SSS.

end_time string

The time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.

end_time string

The time when the task was completed. format is YYYY-MM-DD HH:mm:ss.SSS.

video_urlstring

The video URL. Returned only when task_status is SUCCEEDED.

The video format is MP4 (H.264 encoding). The video link is valid for 24 hours. Please download it promptly.

orig_prompt string

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

codestring

Error code. Returned only for failed requests. See Error codes.

messagestring

Detailed error message. Returned only for failed requests. See Error codes.

usage object

Output usage statistics, counted only for successful tasks.

Properties

duration integer

The total billable video duration in seconds.

output_video_durationinteger

The duration of the output video in seconds.

size string

The resolution of the output video.

fps integer

The frame rate of the output video. This is fixed at 24.

SR string

The resolution tier of the output video.

audio boolean

Indicates whether the output is a video with audio.

video_count integer

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

request_idstring

Unique request identifier for tracing and troubleshooting.

Task succeeded

{
    "request_id": "3606f9f4-b833-44ec-8385-xxxxxx",
    "output": {
        "task_id": "2846881f-0496-4288-947f-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-03-27 14:25:32.057",
        "scheduled_time": "2026-03-27 14:25:32.084",
        "end_time": "2026-03-27 14:28:29.600",
        "orig_prompt": "镜头从海龟下方缓缓上移,海龟悠然游动,腹部细节清晰可见。",
        "video_url": "https://prod-ss-vidu.s3.cn-northwest-1.amazonaws.com.cn/xxx.mp4?xxxx"
    },
    "usage": {
        "duration": 5,
        "size": "990*932",
        "output_video_duration": 5,
        "fps": 24,
        "video_count": 1,
        "audio": false,
        "SR": "720"
    }
}

Task failed

If the task fails, task_status will be set to FAILED, and an error code and message will be provided. See Error codes for troubleshooting.

{
    "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"
    }
}

Task query expired

The task_id can be used for queries within 24 hours. After that, queries are no longer available, and the following error message is returned.

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

Error codes

If a model call fails, see Error Messages to troubleshoot the error.