Tongyi - text-to-image - Z-Image is a lightweight model that quickly generates images, supports Chinese and English text rendering, and adapts to various resolutions and aspect ratios.
Quick links: Technical blog
Prerequisites
You must have obtained and configured an API key and set the API key as an environment variable (this step is being deprecated and will be consolidated into the API key configuration).
Examples
Input prompt | Output image |
Photo of a stylish young woman with short black hair standing confidently in front of a vibrant cartoon-style mural wall. She wears an all-black outfit: a puffed bomber jacket with a ruffled collar, cargo shorts, fishnet tights, and chunky black Doc Martens, with a gold chain dangling from her waist. The background features four colorful comic-style panels: one reads “GRAND STAGE” and includes sneakers and a Gatorade bottle; another displays green Nike sneakers and a slice of pizza; the third reads “HARAJUKU st” with floating shoes; and the fourth shows a blue mouse riding a skateboard with the text “Takeshita WELCOME.” Dominant bright colors include yellow, teal, orange, pink, and green. Speech bubbles, halftone patterns, and playful characters enhance the urban street-art aesthetic. Daylight evenly illuminates the scene, and the ground beneath her feet is white tiled pavement. Full-body portrait, centered composition, slightly tilted stance, direct eye contact with the camera. High detail, sharp focus, dynamic framing. |
|
Model overview
Model | Description | Output image specifications |
z-image-turbo | A lightweight model for fast image generation | Image resolution: Total pixels between 512×512 and 2048×2048. For recommended resolutions, see the size parameter. Image format: png Number of images: Fixed at 1. |
Before making a call, check the list of models supported in each region.
Synchronous HTTP call
Singapore region: POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
Beijing region: POST https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
Request parameters | Text-to-imageThe following example returns an image directly for a faster response time. To enable the intelligent rewriting feature, set The following example uses the base URL for the Singapore region. If you use a model from the China (Beijing) region, replace the base URL with |
Request headers | |
Content-Type The content type of the request. Set this parameter to | |
Authorization The identity authentication credentials for the request. This API uses an Model Studio API key for identity authentication. Example: Bearer sk-xxxx. | |
Request body | |
model The model name. Example: z-image-turbo. | |
input The input for the model. | |
parameters Parameters for image generation. |
Response parameters | Successful task executionTask data, such as the task status and image URLs, is retained for only 24 hours and is automatically purged after this period. You must save the generated images promptly. Abnormal task executionIf a task fails, the system returns information about the failure. The `code` and `message` fields indicate the cause of the error. For more information, see Error messages. |
output The output of the task. | |
usage Usage statistics for the task. Only successful tasks are included in the statistics. | |
request_id The unique request ID. You can use this ID to trace and troubleshoot issues. | |
code The error code for a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. | |
message The detailed information about a failed request. This parameter is not returned if the request is successful. For more information, see Error messages. |
Limits
Data validity: The
task_idand imageurlare retained for only 24 hours. After this period, they cannot be queried or downloaded.Content moderation: The input
promptand the output image are both subject to content moderation review. Requests that contain prohibited content result in an `IPInfringementSuspect` or `DataInspectionFailed` error. For more information, see Error messages.Network access configuration: Image URLs are stored in Object Storage Service. If your business system cannot access external OSS URLs due to security policies, you must add the following OSS domain names to the whitelist.
# List of OSS domain names dashscope-result-bj.oss-cn-beijing.aliyuncs.com dashscope-result-hz.oss-cn-hangzhou.aliyuncs.com dashscope-result-sh.oss-cn-shanghai.aliyuncs.com dashscope-result-wlcb.oss-cn-wulanchabu.aliyuncs.com dashscope-result-zjk.oss-cn-zhangjiakou.aliyuncs.com dashscope-result-sz.oss-cn-shenzhen.aliyuncs.com dashscope-result-hy.oss-cn-heyuan.aliyuncs.com dashscope-result-cd.oss-cn-chengdu.aliyuncs.com dashscope-result-gz.oss-cn-guangzhou.aliyuncs.com dashscope-result-wlcb-acdr-1.oss-cn-wulanchabu-acdr-1.aliyuncs.com
Billing and rate limiting
For the model's free quota and unit price, see Model pricing.
For model rate limits, see Tongyi - text-to-image - Z-Image.
Billing details:
Billing is based on the number of successfully generated images and whether intelligent rewriting is enabled. You are charged only when the API response returns a
task_statusofSUCCEEDEDand an image is successfully generated.Failed model calls or processing errors do not incur any fees and do not consume your free quota.
Error codes
If a model call fails and returns an error message, see Error messages to resolve the issue.
FAQ
Q: How can I view the model call volume?
A: About one hour after a model call, you can go to the Model Observation (Singapore), or Model Observation (Beijing) page to view metrics such as the number of calls and the success rate. For more information, see How do I view model call records?
