aliyun-zimage-turbo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Category: provider
Category: provider

Model Studio Z-Image Turbo

模型工作室 Z-Image Turbo

Use Z-Image Turbo for fast text-to-image generation via the DashScope multimodal-generation API.
通过DashScope多模态生成API使用Z-Image Turbo实现快速文生图生成。

Critical model name

关键模型名称

Use ONLY this exact model string:
  • z-image-turbo
仅使用以下精确模型字符串:
  • z-image-turbo

Prerequisites

前置条件

  • Set
    DASHSCOPE_API_KEY
    in your environment, or add
    dashscope_api_key
    to
    ~/.alibabacloud/credentials
    (env takes precedence).
  • Choose region endpoint (Beijing or Singapore). If unsure, pick the most reasonable region or ask the user.
  • 在你的环境中设置
    DASHSCOPE_API_KEY
    ,或者在
    ~/.alibabacloud/credentials
    中添加
    dashscope_api_key
    (环境变量优先级更高)。
  • 选择区域端点(北京或新加坡)。如果不确定,选择最合理的区域或者询问用户。

Normalized interface (image.generate)

标准化接口(image.generate)

Request

请求参数

  • prompt
    (string, required)
  • size
    (string, optional) e.g.
    1024*1024
  • seed
    (int, optional)
  • prompt_extend
    (bool, optional; default false)
  • base_url
    (string, optional) override API endpoint
  • prompt
    (字符串,必填)
  • size
    (字符串,选填)例如
    1024*1024
  • seed
    (整数,选填)
  • prompt_extend
    (布尔值,选填;默认值false)
  • base_url
    (字符串,选填)覆盖API端点

Response

响应参数

  • image_url
    (string)
  • width
    (int)
  • height
    (int)
  • prompt
    (string)
  • rewritten_prompt
    (string, optional)
  • reasoning
    (string, optional)
  • request_id
    (string)
  • image_url
    (字符串)
  • width
    (整数)
  • height
    (整数)
  • prompt
    (字符串)
  • rewritten_prompt
    (字符串,选填)
  • reasoning
    (字符串,选填)
  • request_id
    (字符串)

Quick start (curl)

快速开始(curl)

bash
curl -sS 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -d '{
    "model": "z-image-turbo",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [{"text": "A calm lake at dawn, a lone angler casting a line, cinematic lighting"}]
        }
      ]
    },
    "parameters": {
      "size": "1024*1024",
      "prompt_extend": false
    }
  }'
bash
curl -sS 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -d '{
    "model": "z-image-turbo",
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [{"text": "A calm lake at dawn, a lone angler casting a line, cinematic lighting"}]
        }
      ]
    },
    "parameters": {
      "size": "1024*1024",
      "prompt_extend": false
    }
  }'

Local helper script

本地辅助脚本

bash
python skills/ai/image/aliyun-zimage-turbo/scripts/generate_image.py \
  --request '{"prompt":"a fishing scene at dawn, cinematic, realistic","size":"1024*1024"}' \
  --output output/ai-image-zimage-turbo/images/fishing.png \
  --print-response
bash
python skills/ai/image/aliyun-zimage-turbo/scripts/generate_image.py \
  --request '{"prompt":"a fishing scene at dawn, cinematic, realistic","size":"1024*1024"}' \
  --output output/ai-image-zimage-turbo/images/fishing.png \
  --print-response

Size notes

尺寸说明

  • Total pixels must be between
    512*512
    and
    2048*2048
    .
  • Prefer common sizes like
    1024*1024
    ,
    1280*720
    ,
    1536*864
    .
  • 总像素必须在
    512*512
    2048*2048
    之间。
  • 推荐使用常用尺寸如
    1024*1024
    1280*720
    1536*864

Cost note

费用说明

  • prompt_extend=true
    is billed higher than
    false
    . Only enable when you need rewritten prompts.
  • prompt_extend=true
    的计费高于
    false
    。仅当你需要重写提示词时才启用该参数。

Output location

输出位置

  • Default output:
    output/ai-image-zimage-turbo/images/
  • Override base dir with
    OUTPUT_DIR
    .
  • 默认输出路径:
    output/ai-image-zimage-turbo/images/
  • 可通过
    OUTPUT_DIR
    覆盖基础目录。

Validation

校验

bash
mkdir -p output/aliyun-zimage-turbo
for f in skills/ai/image/aliyun-zimage-turbo/scripts/*.py; do
  python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/aliyun-zimage-turbo/validate.txt
Pass criteria: command exits 0 and
output/aliyun-zimage-turbo/validate.txt
is generated.
bash
mkdir -p output/aliyun-zimage-turbo
for f in skills/ai/image/aliyun-zimage-turbo/scripts/*.py; do
  python3 -m py_compile "$f"
done
echo "py_compile_ok" > output/aliyun-zimage-turbo/validate.txt
通过标准:命令退出码为0且生成了
output/aliyun-zimage-turbo/validate.txt
文件。

Output And Evidence

输出与凭证

  • Save artifacts, command outputs, and API response summaries under
    output/aliyun-zimage-turbo/
    .
  • Include key parameters (region/resource id/time range) in evidence files for reproducibility.
  • 将产物、命令输出和API响应摘要保存在
    output/aliyun-zimage-turbo/
    目录下。
  • 在凭证文件中包含关键参数(区域/资源ID/时间范围)以便复现。

Workflow

工作流程

  1. Confirm user intent, region, identifiers, and whether the operation is read-only or mutating.
  2. Run one minimal read-only query first to verify connectivity and permissions.
  3. Execute the target operation with explicit parameters and bounded scope.
  4. Verify results and save output/evidence files.
  1. 确认用户意图、区域、标识符,以及操作是只读还是修改性质。
  2. 先运行一个最小化的只读查询,验证连通性和权限。
  3. 使用明确的参数和有限范围执行目标操作。
  4. 验证结果并保存输出/凭证文件。

References

参考

  • references/api_reference.md
    for request/response schema and regional endpoints.
  • references/sources.md
    for official docs.
  • references/api_reference.md
    查看请求/响应schema和区域端点。
  • references/sources.md
    查看官方文档。