Tradução de apoio para consulta. Código e identificadores técnicos preservados. Consultar referência original ↗
Wan 2.7 — Gere ou edite uma imagem
Assíncrono Wan 2.7 geração e edição de imagens
Obtenha uma chave de API e defini-lo como uma variável de ambiente. Se estiver usando o SDK, instale-o.
As tarefas de geração de imagens levam de 1 a 2 minutos. Use a API assíncrona para evitar tempos limite de solicitação, dividindo o processo em duas etapas:
- Crie uma tarefa (este endpoint) e receba um
task_id. - Consulte o resultado pesquisando com o
task_id.
O corpo da solicitação usa o mesmo messages formato e parâmetros como o endpoint síncrono, mas exige a X-DashScope-Async: enable cabeçalho.
OpenAPI
openapi: 3.1.0
info:
title: Wan2.7 Image Generation and Editing API
description: Wan2.7 image generation and editing API. Supports text-to-image, multi-image editing, interactive editing with bounding boxes, and image set generation.
version: 1.0.0
servers:
- url: https://maas.qwencloudapi.com/api/v1
description: Singapore
security:
- BearerAuth: []
paths:
/services/aigc/image-generation/generation:
post:
operationId: createWan27ImageTask
summary: Create image generation task
description: |-
Create an async image generation or editing task. The request body uses the same format as the synchronous endpoint, but requires the `X-DashScope-Async: enable` header.
Image generation tasks take 1 to 2 minutes. Use the async API to avoid request timeouts.
parameters:
- name: X-DashScope-Async
in: header
required: true
description: Asynchronous processing configuration. **Must be set to `enable`**.
schema:
type: string
enum:
- enable
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Wan27ImageRequest"
responses:
"200":
description: Task created 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: curl
label: cURL (text-to-image, async)
source: |-
curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "A flower shop with exquisite windows, a beautiful wooden door, and flowers on display"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "2K",
"watermark": false,
"thinking_mode": true
}
}'
- lang: curl
label: cURL (image editing, async)
source: |-
curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp"
},
{
"image": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp"
},
{
"text": "Spray the graffiti from image 2 onto the car in image 1"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "2K",
"watermark": false
}
}'
- lang: curl
label: cURL (interactive editing, async)
source: |-
curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"image": "https://img.alicdn.com/imgextra/i3/O1CN0157XGE51l6iL9441yX_!!6000000004770-49-tps-1104-1472.webp"
},
{
"image": "https://img.alicdn.com/imgextra/i3/O1CN01SfG4J41UYn9WNt4X1_!!6000000002530-49-tps-1696-960.webp"
},
{
"text": "Place the alarm clock from image 1 in the selected area of image 2, ensuring the scene and lighting blend naturally"
}
]
}
]
},
"parameters": {
"n": 1,
"size": "2K",
"watermark": false,
"bbox_list": [[], [[989, 515, 1138, 681]]]
}
}'
- lang: curl
label: cURL (image set generation, async)
source: |-
curl --location 'https://maas.qwencloudapi.com/api/v1/services/aigc/image-generation/generation' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'X-DashScope-Async: enable' \
--data '{
"model": "wan2.7-image-pro",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"text": "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints."
}
]
}
]
},
"parameters": {
"enable_sequential": true,
"n": 4,
"size": "2K"
}
}'
- lang: python
label: Python - image editing (async)
source: |-
import os
import base64
import mimetypes
import dashscope
from dashscope.aigc.image_generation import ImageGeneration
from dashscope.api_entities.dashscope_response import Message
# SDK version >= 1.25.15 required
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
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}"
# Three input methods: public URL, local file path, Base64 encoding
image_1 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp"
image_2 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp"
# image_1 = "file:///path/to/your/car.png"
# image_1 = encode_file("/path/to/your/car.png")
message = Message(
role="user",
content=[
{"text": "Spray the graffiti from image 2 onto the car in image 1"},
{"image": image_1},
{"image": image_2}
]
)
print("---async call for image editing, creating task----")
response = ImageGeneration.async_call(
model='wan2.7-image-pro',
api_key=api_key,
messages=[message],
n=1,
# wan2.7-image-pro only supports 4K for text-to-image;
# image editing and sequential generation support up to 2K
size="2K",
watermark=False
)
print("Task created:", response)
# Wait for task completion
result = ImageGeneration.wait(task=response, api_key=api_key)
print(result)
- lang: python
label: Python - image set generation (async)
source: |-
import os
import base64
import mimetypes
import dashscope
from dashscope.aigc.image_generation import ImageGeneration
from dashscope.api_entities.dashscope_response import Message
# SDK version >= 1.25.15 required
dashscope.base_http_api_url = 'https://maas.qwencloudapi.com/api/v1'
api_key = os.getenv("DASHSCOPE_API_KEY")
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}"
# Text-to-sequential generation (default)
message = Message(
role="user",
content=[
{"text": "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints."}
]
)
# Image-to-sequential generation (uncomment to use)
# Three input methods: public URL, local file path, Base64 encoding
# image_1 = "https://example.com/your-image.png"
# image_1 = "file:///path/to/your/image.png"
# image_1 = encode_file("/path/to/your/image.png")
# message = Message(
# role="user",
# content=[
# {"text": "Generate a sequential image set based on the input image"},
# {"image": image_1}
# ]
# )
print("---async call for image set generation, creating task----")
response = ImageGeneration.async_call(
model='wan2.7-image-pro',
api_key=api_key,
messages=[message],
enable_sequential=True,
n=4,
# wan2.7-image-pro only supports 4K for text-to-image;
# image editing and sequential generation support up to 2K
size="2K"
)
print("Task created:", response)
# Wait for task completion
result = ImageGeneration.wait(task=response, api_key=api_key)
print(result)
- lang: java
label: Java - image editing (async)
source: |-
import com.alibaba.dashscope.aigc.imagegeneration.*;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.exception.UploadFileException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
/**
* wan2.7-image-pro Image Editing - Asynchronous Call Example
* SDK version >= 2.22.13 required
*/
public class Main {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static String encodeFile(String filePath) throws IOException {
byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
String base64String = Base64.getEncoder().encodeToString(fileContent);
String mimeType = Files.probeContentType(Paths.get(filePath));
return "data:" + mimeType + ";base64," + base64String;
}
public static void asyncCall() throws ApiException, NoApiKeyException, UploadFileException {
// Three input methods: public URL, local file path, Base64 encoding
String image1 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp";
String image2 = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/xsunlm/paint.webp";
// String image1 = "file:///path/to/your/car.png";
// String image1 = encodeFile("/path/to/your/car.png");
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Arrays.asList(
Collections.singletonMap("text", "Spray the graffiti from image 2 onto the car in image 1"),
Collections.singletonMap("image", image1),
Collections.singletonMap("image", image2)
)).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.n(1)
// wan2.7-image-pro only supports 4K for text-to-image;
// image editing and sequential generation support up to 2K
.size("2K")
.messages(Arrays.asList(message))
.build();
ImageGeneration imageGeneration = new ImageGeneration();
ImageGenerationResult result = null;
try {
System.out.println("---asynchronous call for image editing, creating task----");
result = imageGeneration.asyncCall(param);
} catch (ApiException | NoApiKeyException | UploadFileException e) {
throw new RuntimeException(e.getMessage());
}
System.out.println("Task creation result:");
System.out.println(JsonUtils.toJson(result));
String taskId = result.getOutput().getTaskId();
waitTask(taskId);
}
public static void waitTask(String taskId) throws ApiException, NoApiKeyException {
ImageGeneration imageGeneration = new ImageGeneration();
System.out.println("\n---waiting for task completion----");
ImageGenerationResult result = imageGeneration.wait(taskId, apiKey);
System.out.println("Task completion result:");
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
asyncCall();
} catch (ApiException | NoApiKeyException | UploadFileException e) {
System.out.println(e.getMessage());
}
}
}
- lang: java
label: Java - image set generation (async)
source: |-
import com.alibaba.dashscope.aigc.imagegeneration.*;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import com.alibaba.dashscope.exception.UploadFileException;
import com.alibaba.dashscope.utils.Constants;
import com.alibaba.dashscope.utils.JsonUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
/**
* wan2.7-image-pro Image Group Generation - Asynchronous Invocation Example
* SDK version >= 2.22.13 required
*/
public class Main {
static {
Constants.baseHttpApiUrl = "https://maas.qwencloudapi.com/api/v1";
}
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
public static String encodeFile(String filePath) throws IOException {
byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
String base64String = Base64.getEncoder().encodeToString(fileContent);
String mimeType = Files.probeContentType(Paths.get(filePath));
return "data:" + mimeType + ";base64," + base64String;
}
public static ImageGenerationResult waitTask(String taskId)
throws ApiException, NoApiKeyException {
ImageGeneration imageGeneration = new ImageGeneration();
return imageGeneration.wait(taskId, apiKey);
}
public static void asyncCall() throws ApiException, NoApiKeyException, UploadFileException {
// Text-to-sequential generation (default)
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Collections.singletonList(
Collections.singletonMap("text", "Cinematic image group, documenting the same stray orange cat, features must be consistent throughout. First image: Spring, an orange cat walks under blooming cherry trees; Second image: Summer, an orange cat rests in the shade of an old street to escape the heat; Third image: Autumn, an orange cat walks on golden fallen leaves; Fourth image: Winter, an orange cat walks on snow, leaving paw prints.")
)).build();
// Image-to-sequential generation (uncomment to use)
// Three input methods: public URL, local file path, Base64 encoding
// String image1 = "https://example.com/your-image.png";
// String image1 = "file:///path/to/your/image.png";
// String image1 = encodeFile("/path/to/your/image.png");
// ImageGenerationMessage message = ImageGenerationMessage.builder()
// .role("user")
// .content(Arrays.asList(
// Collections.singletonMap("text", "Generate a sequential image set based on the input image"),
// Collections.singletonMap("image", image1)
// )).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.messages(Collections.singletonList(message))
.enableSequential(true)
.n(4)
// wan2.7-image-pro only supports 4K for text-to-image;
// image editing and sequential generation support up to 2K
.size("2K")
.build();
ImageGeneration imageGeneration = new ImageGeneration();
ImageGenerationResult taskResult = null;
try {
System.out.println("----async call, creating task----");
taskResult = imageGeneration.asyncCall(param);
} catch (ApiException | NoApiKeyException | UploadFileException e) {
throw new RuntimeException(e.getMessage());
}
System.out.println("Task created: " + JsonUtils.toJson(taskResult));
String taskId = taskResult.getOutput().getTaskId();
ImageGenerationResult result = waitTask(taskId);
System.out.println(JsonUtils.toJson(result));
}
public static void main(String[] args) {
try {
asyncCall();
} catch (ApiException | NoApiKeyException | UploadFileException e) {
System.out.println(e.getMessage());
}
}
}
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
description: DashScope API Key. Create one in the [QwenCloud console](https://home.qwencloud.com/api-keys).
schemas:
Wan27ImageRequest:
type: object
required:
- model
- input
properties:
model:
type: string
description: "The model name. Valid values: wan2.7-image-pro, wan2.7-image."
enum:
- wan2.7-image-pro
- wan2.7-image
example: wan2.7-image-pro
input:
type: object
required:
- messages
description: Input data containing the messages array.
properties:
messages:
type: array
description: An array of request content. Currently, only single-turn conversations are supported. This means you can pass only one set of role and content parameters. Multi-turn conversations are not supported.
minItems: 1
maxItems: 1
items:
$ref: "#/components/schemas/Wan27ImageMessage"
parameters:
$ref: "#/components/schemas/Wan27ImageParameters"
Wan27ImageMessage:
type: object
required:
- role
- content
properties:
role:
type: string
enum:
- user
description: Message role. Must be `user`.
content:
type: array
description: |-
Message content array. Must contain exactly one `text` object and 0 to 9 `image` objects.
When using multiple images, include multiple `image` objects in the array. Image order is determined by array position.
items:
$ref: "#/components/schemas/Wan27ImageContentPart"
Wan27ImageContentPart:
type: object
description: Either an image or text content part.
properties:
text:
type: string
description: The user-entered prompt. Supports Chinese and English. The length cannot exceed 5,000 characters. Each Chinese character, letter, number, or symbol counts as one character. Any excess is automatically truncated. The `content` array must contain exactly one `text` object.
maxLength: 5000
example: Spray the graffiti from image 2 onto the car in image 1
image:
type: string
description: |-
Input image as a public URL (HTTP/HTTPS) or Base64-encoded string (`data:{mime_type};base64,{data}`).
**Image constraints:**
- Formats: JPEG, JPG, PNG (alpha channel not supported), BMP, WEBP.
- Resolution: Width and height each between 240 and 8,000 pixels. Aspect ratio [1:8, 8:1].
- File size: Max 20 MB.
- Quantity: 0 to 9 images per request.
example: https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20251229/pjeqdf/car.webp
Wan27ImageParameters:
type: object
description: Image processing parameters.
properties:
size:
type: string
description: |-
Output image resolution. Two specification methods are available; they cannot be used together.
**wan2.7-image-pro:**
- Method 1 (recommended): `1K`, `2K` (default), or `4K`.
- Scope: Text-to-image (no image input, not generating an image set) supports 1K, 2K, and 4K. Other scenarios support 1K and 2K only.
- Total pixels: 1K = 1024×1024, 2K = 2048×2048, 4K = 4096×4096.
- Aspect ratio: With image input, output matches the aspect ratio of the last input image scaled to the selected resolution. Without image input, output is square.
- Method 2: Specify `width*height` in pixels, aspect ratio [1:8, 8:1].
- Text-to-image: total pixels in [768×768, 4096×4096].
- Other scenarios: total pixels in [768×768, 2048×2048].
**wan2.7-image:**
- Method 1 (recommended): `1K` or `2K` (default). 4K is not supported.
- Method 2: Specify `width*height` in pixels. All scenarios: total pixels in [768×768, 2048×2048], aspect ratio [1:8, 8:1].
The pixel value of the output image may differ slightly from the specified value.
example: 2K
n:
type: integer
description: |-
Number of images to generate.
**Note:** The value of `n` directly affects the cost. Cost = Unit Price × Number of successfully generated images.
- When image set mode is disabled (`enable_sequential=false`): This value represents the number of images to generate. Range: 1–4. Default: 1.
- When image set mode is enabled (`enable_sequential=true`): This value represents the maximum number of images to generate. Range: 1–12. Default: 12. The actual number is determined by the model and will not exceed `n`.
minimum: 1
maximum: 12
default: 1
enable_sequential:
type: boolean
description: |-
Controls the image generation mode.
- `false`: Default value.
- `true`: Enables image set output mode.
default: false
thinking_mode:
type: boolean
description: Specifies whether to enable thinking mode. The default is `true` (enabled). This parameter is effective only when image set mode is disabled and there is no image input. When enabled, the model enhances its inference capabilities to improve image quality, but this increases generation time.
default: true
bbox_list:
type: array
description: |-
The selected area for interactive editing.
- Correspondence: The length of the list must match the number of input images. If an image does not require editing, pass an empty list `[]` at the corresponding position.
- Coordinate format: `[x1, y1, x2, y2]` (top-left x, top-left y, bottom-right x, bottom-right y). Use absolute pixel coordinates of the original image. The top-left coordinate is (0, 0).
- Condition: A single image supports a maximum of 2 bounding boxes.
items:
type: array
description: Bounding boxes for one input image. Empty array means no bounding box.
items:
type: array
description: A single bounding box [x1, y1, x2, y2].
items:
type: integer
minItems: 4
maxItems: 4
maxItems: 2
color_palette:
type: array
description: A custom color theme. An array of objects containing color (`hex`) and proportion (`ratio`). It must include 3 to 10 colors. We recommend setting it to 8. Available only when image set mode is disabled (`enable_sequential=false`).
minItems: 3
maxItems: 10
items:
type: object
required:
- hex
- ratio
properties:
hex:
type: string
description: "The color value in hexadecimal (HEX) format. Example: `#C2D1E6`."
ratio:
type: string
description: The percentage of the color. It must be accurate to two decimal places (for example, `"25.00%"`). The sum of all `ratio` values must be 100.00%.
example:
- hex: "#C2D1E6"
ratio: 60.00%
- hex: "#636574"
ratio: 25.00%
- hex: "#CBD4E4"
ratio: 15.00%
watermark:
type: boolean
description: Adds a watermark label in the bottom-right corner of the image with fixed text "AI Generated".
default: false
seed:
type: integer
description: "Random number seed. Valid range: [0, 2147483647]. Using the same seed yields similar outputs. If omitted, the algorithm uses a random seed. Note: Image generation is probabilistic. Even with the same seed, results may vary."
minimum: 0
maximum: 2147483647
Wan27ImageResponse:
type: object
description: Wan2.7 image generation response.
example:
output:
choices:
- finish_reason: stop
message:
content:
- image: https://dashscope-result-intl.oss-cn-singapore.aliyuncs.com/xxx.png?Expires=xxx
type: image
role: assistant
finished: true
usage:
image_count: 1
input_tokens: 18790
output_tokens: 2
size: 2985*1405
total_tokens: 18792
request_id: a3f4befe-cacd-49c9-8298-xxxxxx
properties:
output:
type: object
properties:
choices:
type: array
description: List of generated results.
items:
$ref: "#/components/schemas/Wan27ImageChoice"
finished:
type: boolean
description: Whether the generation has completed.
usage:
type: object
description: Usage statistics.
properties:
image_count:
type: integer
description: Number of images generated.
input_tokens:
type: integer
description: Number of input tokens consumed.
output_tokens:
type: integer
description: Number of output tokens consumed.
total_tokens:
type: integer
description: Total tokens consumed.
size:
type: string
description: Actual output image dimensions (width×height).
example: 2985*1405
request_id:
type: string
description: Unique request identifier.
example: a3f4befe-cacd-49c9-8298-xxxxxx
Wan27ImageChoice:
type: object
properties:
finish_reason:
type: string
description: Reason for generation completion.
example: stop
message:
type: object
properties:
role:
type: string
example: assistant
content:
type: array
items:
type: object
properties:
image:
type: string
description: URL of the generated image. **URLs expire in 24 hours.** Download and save promptly.
example: https://dashscope-result-intl.oss-cn-singapore.aliyuncs.com/xxx.png?Expires=xxx
type:
type: string
example: image
AsyncTaskSubmitResponse:
type: object
description: Response returned when an async task is successfully submitted.
example:
request_id: ccf4b2f4-bf30-9e13-9461-3a28c6a7bxxx
output:
task_id: 8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx
task_status: PENDING
properties:
request_id:
type: string
description: Unique request identifier.
example: ccf4b2f4-bf30-9e13-9461-3a28c6a7bxxx
output:
type: object
properties:
task_id:
type: string
description: Task identifier. Use this to poll the result endpoint. Valid for 24 hours.
example: 8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx
task_status:
type: string
description: Initial task status. Always `PENDING` immediately after creation.
example: PENDING
Wan27TaskStatusResponse:
type: object
description: Response from the task status query endpoint.
properties:
request_id:
type: string
description: Unique request identifier.
example: 43d9e959-25bc-4dc7-9888-xxxxxx
output:
type: object
properties:
task_id:
type: string
description: Task identifier.
example: 858cad55-4bdc-4ba3-ae6c-xxxxxx
task_status:
type: string
description: "Current task status: `PENDING` (queued), `RUNNING` (processing), `SUCCEEDED` (complete), `FAILED` (error), `CANCELED` (canceled), `UNKNOWN` (invalid or expired task ID)."
enum:
- PENDING
- RUNNING
- SUCCEEDED
- FAILED
- CANCELED
- UNKNOWN
example: SUCCEEDED
submit_time:
type: string
description: Task submission time.
example: 2026-03-31 19:57:58.840
scheduled_time:
type: string
description: Task scheduling time.
example: 2026-03-31 19:57:58.877
end_time:
type: string
description: Task completion time.
example: 2026-03-31 19:58:11.563
finished:
type: boolean
description: Whether the task has finished.
example: true
choices:
type: array
description: Generated images. Only present when `task_status` is `SUCCEEDED`.
items:
$ref: "#/components/schemas/Wan27ImageChoice"
code:
type: string
description: Error code. Only present when `task_status` is `FAILED`.
message:
type: string
description: Error message. Only present when `task_status` is `FAILED`.
usage:
type: object
description: Usage statistics. Only present when `task_status` is `SUCCEEDED`.
properties:
image_count:
type: integer
description: Number of images generated.
input_tokens:
type: integer
description: Number of input tokens consumed.
output_tokens:
type: integer
description: Number of output tokens consumed.
total_tokens:
type: integer
description: Total tokens consumed.
size:
type: string
description: Actual output image dimensions.
example: 2985*1405
DashScopeErrorResponse:
type: object
properties:
code:
type: string
description: Error code.
example: InvalidParameter
message:
type: string
description: Error message.
example: Invalid parameter value
request_id:
type: string
description: Unique request identifier.
example: a3f4befe-cacd-49c9-8298-xxxxxx