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.
Reference: Technical blog
Prerequisites
You must have have created an API key and set the API key as an environment variable.
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 size parameter settings. Image format: png Number of images: Fixed at 1. |
Before making a call, check the list of models supported in each region.
Synchronous HTTP
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 shows how to return an image directly, which results in a faster response time. To enable the intelligent rewriting feature, set |
Request headers | |
Content-Type The content type of the request. Must be | |
Authorization The authentication credentials using a Model Studio API key. Example: | |
Request body | |
model The model name. Example: z-image-turbo. | |
input The input for the model. | |
parameters Image generation parameters. |
Response parameters | Successful task executionTask data (task status and image URLs) is retained for only 24 hours and then automatically purged. Save 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 Unique identifier for the request. Use for tracing and troubleshooting issues. | |
code The error code. Returned only when the request fails. See error codes for details. | |
message Detailed error message. Returned only when the request fails. See error codes for details. |
Limitations
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 output image are both subject to content moderation. Requests containing prohibited content result in anIPInfringementSuspectorDataInspectionFailederror. See error codes for details.Network access configuration: Image URLs are stored in OSS. If your business system cannot access external OSS URLs due to security policies, add the following OSS domain names to your 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 free quota and unit price, see Model pricing.
For 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 query result API 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, see Error messages to troubleshoot the issue based on the returned error message.
FAQ
Q: How can I view the model call volume?
A: 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. The data is available approximately one hour after the model call is complete. For more information, see How to view model call records?
