The Wan2.7 image generation and editing models support text-to-image, text-to-image-set, image-to-image-set, image editing, and multi-image reference generation.
Model Overview
Model | Description | Output Image Specifications |
|---|---|---|
wan2.7-image-pro | Wan2.7 image Pro supports 4K high-definition output for text-to-image (excluding image set generation) | Image format: PNG. For image resolution and dimensions, see the size parameter. |
wan2.7-image | Wan2.7 image, with faster generation speed |
NoteBefore calling, check the model list and prices supported in each region.
Prerequisites
You must have obtained and configured an API Key and configured the API Key in environment variables. Replace DASHSCOPE_API_HOST in the sample code with the obtained API Host.
ImportantThe China (Beijing) and Singapore regions have separate API Keys and request endpoints, which cannot be mixed. Cross-region calls will cause authentication failures or service errors.
ImportantAlibaba Cloud Model Studio has launched workspace-dedicated domains for the China (Beijing) and Singapore regions, which deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:
- China (Beijing) region: migrate from
https://dashscope.aliyuncs.comtohttps://{WorkspaceId}.cn-beijing.maas.aliyuncs.com - Singapore region: migrate from
https://dashscope-intl.aliyuncs.comtohttps://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Here, {WorkspaceId} is your workspace ID, which you can view on the Workspace Details page in the Alibaba Cloud Model Studio console. The existing domains remain available.
HTTP synchronous call
Results are returned in a single request, with a simple workflow. It is recommended for most scenarios.
Singapore
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
When calling, replace {WorkspaceId} with your actual workspace ID.
Beijing
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
When calling, replace {WorkspaceId} with your actual workspace ID.
Request parameters | Text-to-image
Image editingInteractive editingGroup image generation
|
Request Headers | |
Content-Type Request content type. This parameter must be set to | |
Authorization Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx. | |
Request Body | |
model Model. Valid values: | |
input Basic input information. | |
parameters Model parameter configuration. |
Response parameters | Task executed successfullyTask data (such as task status and image URLs) is retained for only 24 hours and is automatically deleted after it expires. Be sure to save the generated images in a timely manner. Task execution exceptionIf the task fails for some reason, related information is returned, and the cause of the error is clearly indicated by the code and message fields. See Error codes for troubleshooting. |
output Task output information. | |
usage Output information statistics. Only successful results are counted. | |
request_id The unique identifier of the request. It can be used for tracing request details and troubleshooting. | |
code The error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. | |
message The detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
HTTP asynchronous call
Suitable for time-consuming tasks. It supports querying task status and results.
Step 1: Create a task to obtain the task ID
Singapore
POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation
When calling, replace {WorkspaceId} with your actual workspace ID.
Beijing
POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/image-generation/generation
When calling, replace {WorkspaceId} with your actual workspace ID.
Request parameters | Text-to-image
Image editingInteractive editingGroup image generation
|
Request Headers | |
Content-Type Request content type. This parameter must be set to | |
Authorization Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx. | |
X-DashScope-Async Asynchronous processing configuration parameter. HTTP requests only support asynchronous processing, so this parameter must be set to ImportantIf this request header is missing, the following error is returned: "current user api does not support synchronous calls". | |
Request Body | |
model Model. Valid values: | |
input Basic input information. | |
parameters Model parameter configuration. |
Response parameters | Success responseSave the task_id, which is used to query the task status and results. Error responseIf the task fails to be created, see Error codes for troubleshooting. |
output Task output information. | |
request_id The unique identifier of the request. It can be used for tracing request details and troubleshooting. | |
code The error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. | |
message The detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Step 2: Query the result by task ID
Singapore
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
Beijing
GET https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/tasks/{task_id}
Request parameters | Query task resultsReplace |
Request Headers | |
Authorization Request authentication. The API uses an Alibaba Cloud Model Studio API Key for authentication. Example value: Bearer sk-xxxx. | |
URL Path Parameters | |
task_id The node ID. |
Response parameters | Task executed successfullyTask data (such as task status and image URLs) is retained for only 24 hours and is automatically deleted after it expires. Be sure to save the generated images in a timely manner. Task execution exceptionIf the task fails for some reason, related information is returned, and the cause of the error is clearly indicated by the code and message fields. See Error codes for troubleshooting. |
output Task output information. | |
usage Output information statistics. Only successful results are counted. | |
request_id The unique identifier of the request. It can be used for tracing request details and troubleshooting. | |
code The error code returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. | |
message The detailed error information returned when the request fails. This parameter is not returned when the request succeeds. For more information, see Error codes. |
Python SDK calls
SDK parameter naming is basically the same as that of the HTTP API.
Nodes may take a long time. The SDK has encapsulated the HTTP asynchronous call process and supports both synchronous and asynchronous calls.
The actual duration depends on the number of queued nodes and service execution. Please wait patiently when obtaining the results.
ImportantMake sure the DashScope Python SDK version is no earlier than 2.1.0 before running the following code. For updates, see Install SDK.
The base_url and API Key of each region are not interchangeable. The following examples use the Singapore region as an example:
Singapore
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
When calling, replace {WorkspaceId} with your actual Workspace ID.
China (Beijing)
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1
When calling, replace {WorkspaceId} with your actual Workspace ID.
Image editing
Synchronous call
Request example
import os
import base64
import mimetypes
import urllib.request
import dashscope
# 以下为新加坡地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="ap-southeast-1",
)
# --- Base64编码函数 ---
# base64编码格式为 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("不支持或无法识别的图像格式")
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}"
"""
图像输入方式说明:
以下提供了三种图片输入方式,三选一即可
1. 使用公网URL - 适合已有公开可访问的图片
2. 使用本地文件 - 适合本地开发测试
3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
"""
# 【方式一】使用公网图片 URL
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_2 = "file:///path/to/your/paint.png"
# 【方式三】使用Base64编码的图片
# image_1 = encode_file("/path/to/your/car.png")
# image_2 = encode_file("/path/to/your/paint.png")
print("----sync call, please wait a moment----")
# generate 为一步式调用(提交+等待),直接返回已完成的任务结果
job = client.images.generate(
model="wan2.7-image-pro",
prompt="把图2的涂鸦喷绘在图1的汽车上",
# 参考图列表,支持本地文件 如 "file:///path/to/your/car.png"
image_urls=[image_1, image_2],
watermark=False,
n=1,
size="2K", # wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
)
# 提取结果图片URL并保存到本地
for i, image_url in enumerate(job.image_urls):
file_name = f"output_{i}.png"
# 结果URL有效期为24小时,请及时下载
urllib.request.urlretrieve(image_url, file_name)
print(f"Image saved to {file_name}")
Response example
The URL is valid for 24 hours. Download the image promptly.
{
"status_code": 200,
"request_id": "81d868c6-6ce1-92d8-a90d-d2ee71xxxxxx",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"audio": null,
"finished": true
},
"usage": {
"input_tokens": 18790,
"output_tokens": 2,
"characters": 0,
"image_count": 1,
"size": "2985*1405",
"total_tokens": 18792
}
}
Asynchronous call
Request example
import os
import base64
import mimetypes
import urllib.request
import dashscope
# 以下为新加坡地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="ap-southeast-1",
)
# --- Base64编码函数 ---
# base64编码格式为 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("不支持或无法识别的图像格式")
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}"
"""
图像输入方式说明:
以下提供了三种图片输入方式,三选一即可
1. 使用公网URL - 适合已有公开可访问的图片
2. 使用本地文件 - 适合本地开发测试
3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
"""
# 【方式一】使用公网图片 URL
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_2 = "file:///path/to/your/paint.png"
# 【方式三】使用Base64编码的图片
# image_1 = encode_file("/path/to/your/car.png")
# image_2 = encode_file("/path/to/your/paint.png")
# 创建异步任务
def create_async_task():
print("Creating async task...")
job = client.images.jobs.create(
model="wan2.7-image-pro",
prompt="把图2的涂鸦喷绘在图1的汽车上",
extra_input={'images': [image_1, image_2]},
watermark=False,
n=1,
size="2K", # wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
)
print("Task created successfully:", job.task_id, job.status)
return job
# 等待任务完成(指数退避轮询,默认总预算24小时;任务失败会抛出DashScopeError)
def wait_for_completion(job):
print("Waiting for task completion...")
done = client.images.jobs.wait(job)
print("Task succeeded!")
# 提取结果图片URL并保存到本地
for i, image_url in enumerate(done.image_urls):
file_name = f"output_{i}.png"
# 结果URL有效期为24小时,请及时下载
urllib.request.urlretrieve(image_url, file_name)
print(f"Image saved to {file_name}")
# 获取异步任务信息
def fetch_task_status(task_id):
print("Fetching task status...")
snapshot = client.images.jobs.fetch(task_id)
print("Task status:", snapshot.status)
# 取消异步任务,只有处于PENDING状态的任务才可以取消
def cancel_task(task_id):
print("Canceling task...")
client.images.jobs.cancel(task_id)
# 主执行流程
if __name__ == "__main__":
job = create_async_task()
wait_for_completion(job)
Response example
- Response example of creating a node
{
"status_code": 200,
"request_id": "4fb3050f-de57-4a24-84ff-e37ee5xxxxxx",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": null,
"audio": null,
"task_id": "127ec645-118f-4884-955d-0eba8dxxxxxx",
"task_status": "PENDING"
},
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"characters": 0
}
}
- Response example of querying the node result
The URL is valid for 24 hours. Download the image promptly.
{
"status_code": 200,
"request_id": "3b99aae5-d26f-9059-8dd0-ee9ca4804xxx",
"code": null,
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"audio": null,
"task_id": "127ec645-118f-4884-955d-0eba8dxxxxxx",
"task_status": "SUCCEEDED",
"submit_time": "2026-03-31 22:58:47.646",
"scheduled_time": "2026-03-31 22:58:47.683",
"end_time": "2026-03-31 22:58:59.642",
"finished": true
},
"usage": {
"input_tokens": 18711,
"output_tokens": 2,
"characters": 0,
"size": "2985*1405",
"total_tokens": 18713,
"image_count": 1
}
}
Sequential image generation
Synchronous call
Request example
import os
import base64
import mimetypes
import urllib.request
import dashscope
# 以下为新加坡地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="ap-southeast-1",
)
# --- Base64编码函数 ---
# base64编码格式为 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("不支持或无法识别的图像格式")
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}"
"""
图像输入方式说明(图生组图场景):
以下提供了三种图片输入方式,三选一即可
1. 使用公网URL - 适合已有公开可访问的图片
2. 使用本地文件 - 适合本地开发测试
3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
"""
# 【方式一】使用公网图片 URL
# image_1 = "https://img.alicdn.com/imgextra/i4/O1CN01IM44WN23dq5uY1yla_!!6000000007279-49-tps-1024-1024.webp"
# 【方式二】使用本地文件(支持绝对路径和相对路径)
# image_1 = "file:///path/to/your/image.png"
# 【方式三】使用Base64编码的图片
# image_1 = encode_file("/path/to/your/image.png")
print("----sync call, please wait a moment----")
# generate 为一步式调用(提交+等待),直接返回已完成的任务结果
job = client.images.generate(
model="wan2.7-image-pro",
prompt="电影感组图,记录同一只流浪橘猫,特征必须前后一致。第一张:春天,橘猫穿梭在盛开的樱花树下;第二张:夏天,橘猫在老街的树荫下乘凉避暑;第三张:秋天,橘猫踩在满地的金色落叶上;第四张:冬天,橘猫在雪地上走留下足迹。",
# 图生组图场景:取消以下注释,传入参考图(并将上方提示词改为参考图片风格生成四季组图)
# image_urls=[image_1],
parameters={"enable_sequential": True}, # 组图生成
n=4,
size="2K", # wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
)
# 提取结果图片URL并保存到本地
for i, image_url in enumerate(job.image_urls):
file_name = f"output_{i}.png"
# 结果URL有效期为24小时,请及时下载
urllib.request.urlretrieve(image_url, file_name)
print(f"Image saved to {file_name}")
Response example
The URL is valid for 24 hours. Download the image promptly.
{
"status_code": 200,
"request_id": "56e318fd-ed60-99e8-8ca1-cdef25ca4xxx",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"audio": null,
"finished": true
},
"usage": {
"input_tokens": 720,
"output_tokens": 11,
"characters": 0,
"image_count": 4,
"size": "2048*2048",
"total_tokens": 731
}
}
Asynchronous call
Request example
import os
import base64
import mimetypes
import urllib.request
import dashscope
# 以下为新加坡地域的配置,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的region取值不同。
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
# 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
client = dashscope.Client(
api_key=os.getenv("DASHSCOPE_API_KEY"),
workspace="{WorkspaceId}",
region="ap-southeast-1",
)
# --- Base64编码函数 ---
# base64编码格式为 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("不支持或无法识别的图像格式")
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}"
"""
图像输入方式说明(图生组图场景):
以下提供了三种图片输入方式,三选一即可
1. 使用公网URL - 适合已有公开可访问的图片
2. 使用本地文件 - 适合本地开发测试
3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
"""
# 【方式一】使用公网图片 URL
# image_1 = "https://img.alicdn.com/imgextra/i4/O1CN01IM44WN23dq5uY1yla_!!6000000007279-49-tps-1024-1024.webp"
# 【方式二】使用本地文件(支持绝对路径和相对路径)
# image_1 = "file:///path/to/your/image.png"
# 【方式三】使用Base64编码的图片
# image_1 = encode_file("/path/to/your/image.png")
def main():
# 提交异步任务
print("提交异步任务...")
job = client.images.jobs.create(
model="wan2.7-image-pro",
prompt="电影感组图,记录同一只流浪橘猫,特征必须前后一致。第一张:春天,橘猫穿梭在盛开的樱花树下;第二张:夏天,橘猫在老街的树荫下乘凉避暑;第三张:秋天,橘猫踩在满地的金色落叶上;第四张:冬天,橘猫在雪地上走留下足迹。",
# 图生组图场景:取消以下注释,传入参考图(并将上方提示词改为参考图片风格生成四季组图)
# extra_input={'images': [image_1]},
parameters={"enable_sequential": True}, # 组图生成
n=4,
size="2K", # wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
)
print(f"任务提交成功,任务ID: {job.task_id}")
# 等待任务完成(指数退避轮询,默认总预算24小时;任务失败会抛出DashScopeError)
done = client.images.jobs.wait(job)
if done.succeeded:
print("任务完成!")
# 提取结果图片URL并保存到本地
for i, image_url in enumerate(done.image_urls):
file_name = f"output_{i}.png"
# 结果URL有效期为24小时,请及时下载
urllib.request.urlretrieve(image_url, file_name)
print(f"Image saved to {file_name}")
else:
print(f"任务失败,状态: {done.status}")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"错误: {e}")
Response example
- Response example of creating a node
{
"status_code": 200,
"request_id": "4fb3050f-de57-4a24-84ff-e37ee5xxxxxx",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": null,
"audio": null,
"task_id": "77093787-a217-4c29-9cd4-ca7b5ac86xxx",
"task_status": "PENDING"
},
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"characters": 0
}
}
- Response example of querying the node result
The URL is valid for 24 hours. Download the image promptly.
{
"status_code": 200,
"request_id": "56e318fd-ed60-99e8-8ca1-cdef25ca4xxx",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"audio": null,
"task_id": "77093787-a217-4c29-9cd4-ca7b5ac86xxx",
"task_status": "SUCCEEDED",
"submit_time": "2026-03-31 23:04:46.166",
"scheduled_time": "2026-03-31 23:04:46.208",
"end_time": "2026-03-31 23:05:11.664",
"finished": true
},
"usage": {
"input_tokens": 720,
"output_tokens": 11,
"characters": 0,
"size": "2048*2048",
"total_tokens": 731,
"image_count": 4
}
}
Java SDK calls
SDK parameter naming is basically the same as that of the HTTP API.
Nodes may take a long time. The SDK has encapsulated the HTTP asynchronous call process and supports both synchronous and asynchronous calls.
ImportantMake sure that the DashScope Java SDK version is 2.22.13 or later; otherwise, some parameters used in this topic may not be supported.
Singapore
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1
When calling, replace {WorkspaceId} with your actual Workspace ID.
China (Beijing)
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1
When calling, replace {WorkspaceId} with your actual Workspace ID.
Image editing
Synchronous call
Request example
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.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* wan2.7-image-pro 图像编辑 - 同步调用示例
*/
public class Main {
static {
// 以下为新加坡地域的URL,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的URL不同。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:apiKey="sk-xxx"
// 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
// --- Base64编码函数 ---
// base64编码格式为 data:{MIME_type};base64,{base64_data}
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 basicCall() throws ApiException, NoApiKeyException, UploadFileException, IOException {
/*
* 图像输入方式说明:
* 以下提供了三种图片输入方式,三选一即可
* 1. 使用公网URL - 适合已有公开可访问的图片
* 2. 使用本地文件 - 适合本地开发测试
* 3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
*/
// 【方式一】使用公网图片 URL
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";
// 【方式二】使用本地文件(支持绝对路径和相对路径)
// 格式要求:file:// + 文件路径
// String image1 = "file:///path/to/your/car.png";
// String image2 = "file:///path/to/your/paint.png";
// 【方式三】使用Base64编码的图片
// String image1 = encodeFile("/path/to/your/car.png");
// String image2 = encodeFile("/path/to/your/paint.png");
// 构建多图输入消息
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Arrays.asList(
// 支持多图输入,可以提供多张参考图片
Collections.singletonMap("text", "把图2的涂鸦喷绘在图1的汽车上"),
Collections.singletonMap("image", image1),
Collections.singletonMap("image", image2)
)).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.messages(Collections.singletonList(message))
.n(1)
.size("2K") // wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
.build();
ImageGeneration imageGeneration = new ImageGeneration();
ImageGenerationResult result = null;
try {
System.out.println("---sync call for image editing, please wait a moment----");
result = imageGeneration.call(param);
} catch (ApiException | NoApiKeyException | UploadFileException e) {
throw new RuntimeException(e.getMessage());
}
// 提取结果图片URL并保存到本地
for (int i = 0; i < result.getOutput().getChoices().size(); i++) {
List<Map<String, Object>> contents = result.getOutput().getChoices().get(i)
.getMessage().getContent();
for (int j = 0; j < contents.size(); j++) {
if ("image".equals(contents.get(j).get("type"))) {
String imageUrl = (String) contents.get(j).get("image");
String fileName = "output_" + i + "_" + j + ".png";
// 结果URL有效期为24小时,请及时下载
try (InputStream in = new URL(imageUrl).openStream()) {
Files.copy(in, Paths.get(fileName), StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Image saved to " + fileName);
}
}
}
}
public static void main(String[] args) throws ApiException, NoApiKeyException, UploadFileException, IOException {
basicCall();
}
}
Response example
The URL is valid for 24 hours. Download and save the images in a timely manner.
{
"requestId": "1bf6173a-e8de-9f75-94d3-5e618f875xxx",
"usage": {
"input_tokens": 18790,
"output_tokens": 2,
"total_tokens": 18792,
"image_count": 1,
"size": "2985*1405"
},
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"finished": true
},
"status_code": 200,
"code": "",
"message": ""
}
Asynchronous call
Request example
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.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* wan2.7-image-pro 图像编辑 - 异步调用示例
*/
public class Main {
static {
// 以下为新加坡地域的URL,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的URL不同。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:apiKey="sk-xxx"
// 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
// --- Base64编码函数 ---
// base64编码格式为 data:{MIME_type};base64,{base64_data}
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, IOException {
/*
* 图像输入方式说明:
* 以下提供了三种图片输入方式,三选一即可
* 1. 使用公网URL - 适合已有公开可访问的图片
* 2. 使用本地文件 - 适合本地开发测试
* 3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
*/
// 【方式一】使用公网图片 URL
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";
// 【方式二】使用本地文件(支持绝对路径和相对路径)
// 格式要求:file:// + 文件路径
// String image1 = "file:///path/to/your/car.png";
// String image2 = "file:///path/to/your/paint.png";
// 【方式三】使用Base64编码的图片
// String image1 = encodeFile("/path/to/your/car.png");
// String image2 = encodeFile("/path/to/your/paint.png");
// 构建多图输入消息
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Arrays.asList(
// 支持多图输入,可以提供多张参考图片
Collections.singletonMap("text", "把图2的涂鸦喷绘在图1的汽车上"),
Collections.singletonMap("image", image1),
Collections.singletonMap("image", image2)
)).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.n(1)
.size("2K") // wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
.messages(Arrays.asList(message))
.build();
ImageGeneration imageGeneration = new ImageGeneration();
ImageGenerationResult result = null;
try {
System.out.println("---async call for image editing, creating task----");
result = imageGeneration.asyncCall(param);
} catch (ApiException | NoApiKeyException | UploadFileException e) {
throw new RuntimeException(e.getMessage());
}
System.out.println("任务创建结果:");
System.out.println(JsonUtils.toJson(result));
String taskId = result.getOutput().getTaskId();
// 等待任务完成
waitTask(taskId);
}
public static void waitTask(String taskId) throws ApiException, NoApiKeyException, IOException {
ImageGeneration imageGeneration = new ImageGeneration();
System.out.println("\n---waiting for task completion----");
ImageGenerationResult result = imageGeneration.wait(taskId, apiKey);
// 提取结果图片URL并保存到本地
for (int i = 0; i < result.getOutput().getChoices().size(); i++) {
List<Map<String, Object>> contents = result.getOutput().getChoices().get(i)
.getMessage().getContent();
for (int j = 0; j < contents.size(); j++) {
if ("image".equals(contents.get(j).get("type"))) {
String imageUrl = (String) contents.get(j).get("image");
String fileName = "output_" + i + "_" + j + ".png";
// 结果URL有效期为24小时,请及时下载
try (InputStream in = new URL(imageUrl).openStream()) {
Files.copy(in, Paths.get(fileName), StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Image saved to " + fileName);
}
}
}
}
public static void main(String[] args) throws ApiException, NoApiKeyException, UploadFileException, IOException {
asyncCall();
}
}
Response example
- Response example of creating a node
{
"requestId": "ccf4b2f4-bf30-9e13-9461-3a28c6a7bxxx",
"output": {
"task_id": "8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx",
"task_status": "PENDING"
},
"status_code": 200,
"code": "",
"message": ""
}
- Response example of querying the node result
The URL is valid for 24 hours. Download and save the images in a timely manner.
{
"requestId": "60a08540-f1c1-9e76-8cd3-d5949db8cxxx",
"usage": {
"input_tokens": 18711,
"output_tokens": 2,
"total_tokens": 18713,
"image_count": 1,
"size": "2985*1405"
},
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"task_id": "8811b4a4-00ac-4aa2-a2fd-017d3b90cxxx",
"task_status": "SUCCEEDED",
"finished": true,
"submit_time": "2026-03-31 19:57:58.840",
"scheduled_time": "2026-03-31 19:57:58.877",
"end_time": "2026-03-31 19:58:11.563"
},
"status_code": 200,
"code": "",
"message": ""
}
Sequential image generation
Synchronous call
Request example
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.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* wan2.7-image-pro 组图生成 - 同步调用示例(新加坡地域)
*/
public class Main {
static {
// 以下为新加坡地域的URL,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的URL不同。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:apiKey="sk-xxx"
// 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
// --- Base64编码函数 ---
// base64编码格式为 data:{MIME_type};base64,{base64_data}
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 basicCall() throws ApiException, NoApiKeyException, UploadFileException, IOException {
/*
* 图像输入方式说明(图生组图场景):
* 以下提供了三种图片输入方式,三选一即可
* 1. 使用公网URL - 适合已有公开可访问的图片
* 2. 使用本地文件 - 适合本地开发测试
* 3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
*/
// 【方式一】使用公网图片 URL
// String image1 = "https://img.alicdn.com/imgextra/i4/O1CN01IM44WN23dq5uY1yla_!!6000000007279-49-tps-1024-1024.webp";
// 【方式二】使用本地文件(支持绝对路径和相对路径)
// 格式要求:file:// + 文件路径
// String image1 = "file:///path/to/your/image.png";
// 【方式三】使用Base64编码的图片
// String image1 = encodeFile("/path/to/your/image.png");
// 构建文本输入消息(支持文生组图以及图生组图,此处以文生组图为例)
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Collections.singletonList(
Collections.singletonMap("text", "电影感组图,记录同一只流浪橘猫,特征必须前后一致。第一张:春天,橘猫穿梭在盛开的樱花树下;第二张:夏天,橘猫在老街的树荫下乘凉避暑;第三张:秋天,橘猫踩在满地的金色落叶上;第四张:冬天,橘猫在雪地上走留下足迹。")
)).build();
// 图生组图场景:取消以下注释并注释掉上方纯文本构建
// ImageGenerationMessage message = ImageGenerationMessage.builder()
// .role("user")
// .content(Arrays.asList(
// Collections.singletonMap("text", "参考图片风格生成四季组图"),
// Collections.singletonMap("image", image1)
// )).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.messages(Collections.singletonList(message))
.enableSequential(true)
.n(4)
.size("2K") // wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高2K分辨率
.build();
ImageGeneration imageGeneration = new ImageGeneration();
ImageGenerationResult result = null;
try {
System.out.println("----sync call, please wait a moment----");
result = imageGeneration.call(param);
} catch (ApiException | NoApiKeyException | UploadFileException e) {
throw new RuntimeException(e.getMessage());
}
// 提取结果图片URL并保存到本地
for (int i = 0; i < result.getOutput().getChoices().size(); i++) {
List<Map<String, Object>> contents = result.getOutput().getChoices().get(i)
.getMessage().getContent();
for (int j = 0; j < contents.size(); j++) {
if ("image".equals(contents.get(j).get("type"))) {
String imageUrl = (String) contents.get(j).get("image");
String fileName = "output_" + i + "_" + j + ".png";
// 结果URL有效期为24小时,请及时下载
try (InputStream in = new URL(imageUrl).openStream()) {
Files.copy(in, Paths.get(fileName), StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Image saved to " + fileName);
}
}
}
}
public static void main(String[] args) throws ApiException, NoApiKeyException, UploadFileException, IOException {
basicCall();
}
}
Response example
The URL is valid for 24 hours. Download and save the images in a timely manner.
{
"requestId": "4678c314-b37a-91c9-a2ae-2d3cd54bbxxx",
"usage": {
"input_tokens": 720,
"output_tokens": 11,
"total_tokens": 731,
"image_count": 4,
"size": "2048*2048"
},
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"finished": true
},
"status_code": 200,
"code": "",
"message": ""
}
Asynchronous call
Request example
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.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* wan2.7-image-pro 组图生成 - 异步调用示例(新加坡地域)
*/
public class Main {
static {
// 以下为新加坡地域的URL,调用时请将{WorkspaceId}替换为真实的业务空间ID,各地域的URL不同。
Constants.baseHttpApiUrl = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1";
}
// 若没有配置环境变量,请用百炼API Key将下行替换为:apiKey="sk-xxx"
// 各地域的API Key不同。获取API Key:https://www.alibabacloud.com/help/model-studio/get-api-key
static String apiKey = System.getenv("DASHSCOPE_API_KEY");
// --- Base64编码函数 ---
// base64编码格式为 data:{MIME_type};base64,{base64_data}
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, IOException {
/*
* 图像输入方式说明(图生组图场景):
* 以下提供了三种图片输入方式,三选一即可
* 1. 使用公网URL - 适合已有公开可访问的图片
* 2. 使用本地文件 - 适合本地开发测试
* 3. 使用Base64编码 - 适合私有图片或需要加密传输的场景
*/
// 【方式一】使用公网图片 URL
// String image1 = "https://img.alicdn.com/imgextra/i4/O1CN01IM44WN23dq5uY1yla_!!6000000007279-49-tps-1024-1024.webp";
// 【方式二】使用本地文件(支持绝对路径和相对路径)
// 格式要求:file:// + 文件路径
// String image1 = "file:///path/to/your/image.png";
// 【方式三】使用Base64编码的图片
// String image1 = encodeFile("/path/to/your/image.png");
// 构建文本输入消息(支持文生组图以及图生组图,此处以文生组图为例)
ImageGenerationMessage message = ImageGenerationMessage.builder()
.role("user")
.content(Collections.singletonList(
Collections.singletonMap("text", "电影感组图,记录同一只流浪橘猫,特征必须前后一致。第一张:春天,橘猫穿梭在盛开的樱花树下;第二张:夏天,橘猫在老街的树荫下乘凉避暑;第三张:秋天,橘猫踩在满地的金色落叶上;第四张:冬天,橘猫在雪地上走留下足迹。")
)).build();
// 图生组图场景:取消以下注释并注释掉上方纯文本构建
// ImageGenerationMessage message = ImageGenerationMessage.builder()
// .role("user")
// .content(Arrays.asList(
// Collections.singletonMap("text", "参考图片风格生成四季组图"),
// Collections.singletonMap("image", image1)
// )).build();
ImageGenerationParam param = ImageGenerationParam.builder()
.apiKey(apiKey)
.model("wan2.7-image-pro")
.messages(Collections.singletonList(message))
.enableSequential(true)
.n(4)
.size("2K") // wan2.7-image-pro仅文生图场景支持4K分辨率,图像编辑和组图生成支持最高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);
// 提取结果图片URL并保存到本地
for (int i = 0; i < result.getOutput().getChoices().size(); i++) {
List<Map<String, Object>> contents = result.getOutput().getChoices().get(i)
.getMessage().getContent();
for (int j = 0; j < contents.size(); j++) {
if ("image".equals(contents.get(j).get("type"))) {
String imageUrl = (String) contents.get(j).get("image");
String fileName = "output_" + i + "_" + j + ".png";
// 结果URL有效期为24小时,请及时下载
try (InputStream in = new URL(imageUrl).openStream()) {
Files.copy(in, Paths.get(fileName), StandardCopyOption.REPLACE_EXISTING);
}
System.out.println("Image saved to " + fileName);
}
}
}
}
public static void main(String[] args) throws ApiException, NoApiKeyException, UploadFileException, IOException {
asyncCall();
}
}
Response example
- Response example of creating a node
{
"requestId": "7d026dc1-e8c9-9caa-84ac-e82e2da97xxx",
"output": {
"task_id": "2de18c56-c151-4b80-8105-1d164733exxx",
"task_status": "PENDING"
},
"status_code": 200,
"code": "",
"message": ""
}
- Response example of querying the node result
The URL is valid for 24 hours. Download and save the images in a timely manner.
{
"requestId": "daea7295-4ce0-928a-9a11-4d2bea058xxx",
"usage": {
"input_tokens": 720,
"output_tokens": 11,
"total_tokens": 731,
"image_count": 4,
"size": "2048*2048"
},
"output": {
"choices": [
{
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": [
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
},
{
"image": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/xxxxxx.png?Expires=xxxxxx",
"type": "image"
}
]
}
}
],
"task_id": "2de18c56-c151-4b80-8105-1d164733exxx",
"task_status": "SUCCEEDED",
"finished": true,
"submit_time": "2026-03-31 19:49:53.124",
"scheduled_time": "2026-03-31 19:49:53.175",
"end_time": "2026-03-31 19:50:53.160"
},
"status_code": 200,
"code": "",
"message": ""
}
Billing and rate limits
- For the free quota and unit prices of the model, see Model price.
- For model rate limits, see Wan.
- Billing: You are billed based on the number of images successfully generated. Failed model calls or processing errors incur no fees and do not consume the free quota for new users.
Error codes
If a model call fails and returns an error message, see Error codes for troubleshooting.