Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan — Animar a partir do primeiro quadro
Enviar tarefa de imagem para vídeo
Gere um vídeo a partir de uma imagem de primeiro quadro e um prompt de texto.
OpenAPI
openapi: 3.1.0
info:
title: Wan Image-to-Video (First Frame) API
description: Generate videos from a first-frame image and text prompt using Wan image-to-video models. Supports audio synchronization, multi-shot narrative, and multiple resolution tiers.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/services/aigc/video-generation/video-synthesis:
post:
operationId: createI2VFirstFrame
summary: Create image-to-video task
description: Create an image-to-video task using the first frame.
parameters:
- name: X-DashScope-Async
in: header
required: true
description: Must be set to `enable`. HTTP requests support only asynchronous processing. Omitting this header returns a "current user api does not support synchronous calls" error.
schema:
type: string
enum:
- enable
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/I2VFirstFrameRequest"
responses:
"200":
description: Task submitted successfully
content:
application/json:
schema:
$ref: "#/components/schemas/AsyncTaskSubmitResponse"
"400":
description: Invalid request parameters
content:
application/json:
schema:
$ref: "#/components/schemas/DashScopeErrorResponse"
x-codeSamples:
- lang: python
label: Python (Synchronous call)
source: |-
import base64
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import mimetypes
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
# SDK version 1.25.8 or later is required
# If you haven't configured the environment variable, replace the next line with your API key: api_key="sk-xxx"
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:
Choose one of the following three methods,
1. Use a public URL - Suitable for publicly accessible images
2. Use a local file - Suitable for local development and testing
3. Use Base64 encoding - Suitable for private images or scenarios requiring encrypted transmission
"""
# [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 requirement: 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 executable file's path
# [Method 3] Use a Base64-encoded image
# img_url = encode_file("./img.png")
# Set audio URL
audio_url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3"
def sample_call_i2v():
# Synchronous call, returns 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()
- lang: python
label: Python (Asynchronous call)
source: |-
import os
from http import HTTPStatus
from dashscope import VideoSynthesis
import dashscope
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
# SDK version 1.25.8 or later is required
# If you haven't configured the environment variable, replace the next line with your API key: api_key="sk-xxx"
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 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 asynchronous task information
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 asynchronous task to finish
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()
- lang: java
label: Java (Synchronous call)
source: |-
// 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 {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
// SDK version 2.22.6 or later is required
}
// If you haven't configured the environment variable, replace the next line with your API key: apiKey="sk-xxx"
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
/**
* Image input methods: Choose one of the following three
*
* 1. Use a public URL - Suitable for publicly accessible images
* 2. Use a local file - Suitable for local development and testing
* 3. Use Base64 encoding - Suitable for private images or scenarios requiring encrypted transmission
*/
// [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 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 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));
}
/**
* Encode a file into a Base64 string
* @param filePath File path
* @return 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);
}
}
- lang: java
label: Java (Asynchronous call)
source: |-
// 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 {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
// SDK version 2.22.6 or later is required
}
// If you haven't configured the environment variable, replace the next line with your API key: api_key="sk-xxx"
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
// Set input image URL
static String imgUrl = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png";
// Set 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 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 result
VideoSynthesisResult result = vs.wait(task, apiKey);
System.out.println(JsonUtils.toJson(result));
}
// Get 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 single task result
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);
}
}
- lang: curl
label: cURL - Multi-shot narrative
source: |-
curl --location 'https://maas.qwencloudapi.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.",
"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"
}
}'
- lang: curl
label: cURL - Automatic dubbing
source: |-
curl --location 'https://maas.qwencloudapi.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
}
}'
- lang: curl
label: cURL - Provide an audio file
source: |-
curl --location 'https://maas.qwencloudapi.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
}
}'
- lang: curl
label: cURL - Silent video
source: |-
curl --location 'https://maas.qwencloudapi.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
}
}'
- lang: curl
label: cURL - Use a negative prompt
source: |-
curl --location 'https://maas.qwencloudapi.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
}
}'
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
I2VFirstFrameRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: Model name.
enum:
- wan2.6-i2v-flash
- wan2.6-i2v
- wan2.5-i2v-preview
- wan2.2-i2v-flash
- wan2.2-i2v-plus
- wan2.1-i2v-turbo
- wan2.1-i2v-plus
example: wan2.6-i2v-flash
input:
type: object
required:
- img_url
description: Input data including the first-frame image, prompt, and optional audio.
properties:
prompt:
type: string
description: |-
Text prompt describing the desired content and visual characteristics for the generated video. Both Chinese and English are supported. Length limits vary by model:
- wan2.6 and wan2.5 models: up to 1,500 characters.
- wan2.2 and wan2.1 models: up to 800 characters.
Text exceeding the limit is truncated automatically. For prompt tips, see Text-to-video/image-to-video prompt guide.
example: A cat running on the grass
negative_prompt:
type: string
description: Negative prompt describing content to exclude from the video. Both Chinese and English are supported. Maximum 500 characters; excess is truncated automatically.
maxLength: 500
example: low resolution, error, worst quality, low quality
img_url:
type: string
description: |-
URL or Base64 string of the first-frame image.
**Image constraints:**
- Format: JPEG, JPG, PNG (no alpha channel), BMP, WEBP.
- Resolution: Width and height must be between 240 and 8,000 pixels.
- File size: Up to 20 MB for Wan2.6 and Wan2.5 series models; up to 10 MB for Wan2.2 and Wan2.1 series models.
**Supported input formats:**
1. Public URL (HTTP/HTTPS supported).
2. Base64-encoded image: `data:{MIME_type};base64,{base64_data}`.
example: https://cdn.translate.alibaba.com/r/wanx-demo-1.png
audio_url:
type: string
description: |-
URL of an audio file. The model synchronizes video generation with this audio. Supported by wan2.6 and wan2.5 models only.
**Audio constraints:**
- Format: wav, mp3.
- Duration: 3–30 seconds.
- File size: Up to 15 MB.
- If the audio exceeds the video `duration`, it is truncated. If shorter, the remaining video is silent.
example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/ozwpvi/rap.mp3
parameters:
$ref: "#/components/schemas/I2VFirstFrameParameters"
I2VFirstFrameParameters:
type: object
description: Video generation parameters.
properties:
resolution:
type: string
description: |-
Resolution tier of the generated video. The model scales output to a similar total pixel count. The aspect ratio closely matches the input image. Resolution directly affects cost (1080P > 720P > 480P).
Default values and options by model:
- wan2.6-i2v-flash: 720P, 1080P (default: 1080P)
- wan2.6-i2v: 720P, 1080P (default: 1080P)
- wan2.5-i2v-preview: 480P, 720P, 1080P (default: 1080P)
- wan2.2-i2v-flash: 480P, 720P, 1080P (default: 720P)
- wan2.2-i2v-plus: 480P, 1080P (default: 1080P)
- wan2.1-i2v-turbo: 480P, 720P (default: 720P)
- wan2.1-i2v-plus: 720P (fixed)
enum:
- 480P
- 720P
- 1080P
example: 720P
duration:
type: integer
description: |-
Duration of the generated video in seconds. Longer durations cost more (billed per second).
Valid values by model:
- wan2.6-i2v-flash: integer 2–15 (default: 5)
- wan2.6-i2v: integer 2–15 (default: 5)
- wan2.5-i2v-preview: 5, 10 (default: 5)
- wan2.2-i2v-plus: fixed 5 (not configurable)
- wan2.2-i2v-flash: fixed 5 (not configurable)
- wan2.1-i2v-plus: fixed 5 (not configurable)
- wan2.1-i2v-turbo: 3, 4, 5 (default: 5)
example: 5
prompt_extend:
type: boolean
description: Whether to enable prompt rewriting. When enabled, an LLM rewrites the input prompt, which can improve generation quality for shorter prompts but increases processing time.
default: true
example: true
shot_type:
type: string
description: Whether the video uses a single continuous shot or multiple switching shots. Supported by wan2.6 models only. Takes effect only when `prompt_extend` is `true`. When specified, overrides shot-related descriptions in the prompt.
enum:
- single
- multi
default: single
example: single
audio:
type: boolean
description: "Whether to generate a video with sound. Supported by wan2.6-i2v-flash only. Priority: `audio` > `audio_url`. If `audio=false`, the output is silent even if `audio_url` is provided. Audio setting affects pricing."
default: true
example: true
watermark:
type: boolean
description: Whether to add an "AI Generated" watermark in the lower-right corner.
default: false
example: false
seed:
type: integer
description: "Random number seed for reproducibility. Range: [0, 2147483647]. If omitted, a random seed is used. Identical seeds do not guarantee identical results."
minimum: 0
maximum: 2147483647
example: 12345
AsyncTaskSubmitResponse:
type: object
description: Response from an asynchronous task submission.
properties:
request_id:
type: string
description: Unique request identifier for tracing and troubleshooting.
example: 4909100c-7b5a-9f92-bfe5-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: Task ID for polling status. Use with `GET /tasks/{task_id}`. Valid for 24 hours.
example: 0385dc79-5ff8-4d82-bcb6-xxxxxx
task_status:
type: string
description: Initial task status, typically `PENDING`.
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
example: PENDING
TaskStatusResponse:
type: object
description: Response from polling a task's status.
properties:
request_id:
type: string
description: Unique request identifier.
example: 2ca1c497-f9e0-449d-9a3f-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: The task ID.
example: af6efbc0-4bef-4194-8246-xxxxxx
task_status:
type: string
description: "Current task status. Transitions: PENDING → RUNNING → SUCCEEDED or FAILED. UNKNOWN means the task does not exist or has expired."
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
submit_time:
type: string
description: "Time when the task was submitted. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-25 11:07:28.590
scheduled_time:
type: string
description: "Time when the task started running. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-25 11:07:35.349
end_time:
type: string
description: "Time when the task completed. UTC+8 format: YYYY-MM-DD HH:mm:ss.SSS."
example: 2025-09-25 11:17:11.650
video_url:
type: string
description: URL of the generated video. Returned only when `task_status` is `SUCCEEDED`. Valid for 24 hours. Download promptly. MP4 format with H.264 encoding.
example: https://dashscope-result-sh.oss-cn-shanghai.aliyuncs.com/xxx.mp4?Expires=xxx
orig_prompt:
type: string
description: The original input prompt.
actual_prompt:
type: string
description: When `prompt_extend=true`, returns the optimized prompt used for generation. Not returned if `prompt_extend=false`. The wan2.6 model never returns this field.
code:
type: string
description: Error code. Returned only when the task fails.
message:
type: string
description: Detailed error message. Returned only when the task fails.
usage:
type: object
description: Output statistics. Returned only for successful tasks. Fields vary by model version.
properties:
duration:
type: integer
description: "Total video duration used for billing. For wan2.6 models: `input_video_duration + output_video_duration`."
input_video_duration:
type: integer
description: Duration of input video in seconds. Fixed at 0 for image-to-video. Returned by wan2.6 models.
output_video_duration:
type: integer
description: Duration of output video in seconds. Returned by wan2.6 models.
video_count:
type: integer
description: Number of generated videos. Fixed at 1.
example: 1
SR:
type: integer
description: Resolution tier of the generated video (e.g., 720). Returned by wan2.6, wan2.5, and wan2.2 models.
example: 720
audio:
type: boolean
description: Whether the output video has sound. Returned by wan2.6-i2v-flash only.
video_duration:
type: integer
description: Duration of generated video in seconds. Returned by wan2.1 models only.
video_ratio:
type: string
description: Aspect ratio of generated video. Fixed at `standard`. Returned by wan2.1 models only.
DashScopeErrorResponse:
type: object
description: DashScope API error response.
properties:
request_id:
type: string
description: Unique request identifier.
code:
type: string
description: Error code (e.g., `InvalidApiKey`, `InvalidParameter`, `Throttling`).
example: InvalidApiKey
message:
type: string
description: Human-readable error message.
example: No API-key provided.