$npx -y skills add cinience/alicloud-skills --skill aliyun-zimage-turboUse when generating images with Alibaba Cloud Model Studio Z-Image Turbo (z-image-turbo) via DashScope multimodal-generation API. Use when creating text-to-image outputs, controlling size/seed/prompt_extend, or documenting request/response mapping for Z-Image.
| 1 | Category: provider |
| 2 | |
| 3 | # Model Studio Z-Image Turbo |
| 4 | |
| 5 | Use Z-Image Turbo for fast text-to-image generation via the DashScope multimodal-generation API. |
| 6 | |
| 7 | ## Critical model name |
| 8 | |
| 9 | Use ONLY this exact model string: |
| 10 | - `z-image-turbo` |
| 11 | |
| 12 | ## Prerequisites |
| 13 | |
| 14 | - Set `DASHSCOPE_API_KEY` in your environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials` (env takes precedence). |
| 15 | - Choose region endpoint (Beijing or Singapore). If unsure, pick the most reasonable region or ask the user. |
| 16 | |
| 17 | ## Normalized interface (image.generate) |
| 18 | |
| 19 | ### Request |
| 20 | - `prompt` (string, required) |
| 21 | - `size` (string, optional) e.g. `1024*1024` |
| 22 | - `seed` (int, optional) |
| 23 | - `prompt_extend` (bool, optional; default false) |
| 24 | - `base_url` (string, optional) override API endpoint |
| 25 | |
| 26 | ### Response |
| 27 | - `image_url` (string) |
| 28 | - `width` (int) |
| 29 | - `height` (int) |
| 30 | - `prompt` (string) |
| 31 | - `rewritten_prompt` (string, optional) |
| 32 | - `reasoning` (string, optional) |
| 33 | - `request_id` (string) |
| 34 | |
| 35 | ## Quick start (curl) |
| 36 | |
| 37 | ```bash |
| 38 | curl -sS 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \ |
| 39 | -H 'Content-Type: application/json' \ |
| 40 | -H "Authorization: Bearer $DASHSCOPE_API_KEY" \ |
| 41 | -d '{ |
| 42 | "model": "z-image-turbo", |
| 43 | "input": { |
| 44 | "messages": [ |
| 45 | { |
| 46 | "role": "user", |
| 47 | "content": [{"text": "A calm lake at dawn, a lone angler casting a line, cinematic lighting"}] |
| 48 | } |
| 49 | ] |
| 50 | }, |
| 51 | "parameters": { |
| 52 | "size": "1024*1024", |
| 53 | "prompt_extend": false |
| 54 | } |
| 55 | }' |
| 56 | ``` |
| 57 | |
| 58 | ## Local helper script |
| 59 | |
| 60 | ```bash |
| 61 | python skills/ai/image/aliyun-zimage-turbo/scripts/generate_image.py \ |
| 62 | --request '{"prompt":"a fishing scene at dawn, cinematic, realistic","size":"1024*1024"}' \ |
| 63 | --output output/ai-image-zimage-turbo/images/fishing.png \ |
| 64 | --print-response |
| 65 | ``` |
| 66 | |
| 67 | ## Size notes |
| 68 | |
| 69 | - Total pixels must be between `512*512` and `2048*2048`. |
| 70 | - Prefer common sizes like `1024*1024`, `1280*720`, `1536*864`. |
| 71 | |
| 72 | ## Cost note |
| 73 | |
| 74 | - `prompt_extend=true` is billed higher than `false`. Only enable when you need rewritten prompts. |
| 75 | |
| 76 | ## Output location |
| 77 | |
| 78 | - Default output: `output/ai-image-zimage-turbo/images/` |
| 79 | - Override base dir with `OUTPUT_DIR`. |
| 80 | |
| 81 | ## Validation |
| 82 | |
| 83 | ```bash |
| 84 | mkdir -p output/aliyun-zimage-turbo |
| 85 | for f in skills/ai/image/aliyun-zimage-turbo/scripts/*.py; do |
| 86 | python3 -m py_compile "$f" |
| 87 | done |
| 88 | echo "py_compile_ok" > output/aliyun-zimage-turbo/validate.txt |
| 89 | ``` |
| 90 | |
| 91 | Pass criteria: command exits 0 and `output/aliyun-zimage-turbo/validate.txt` is generated. |
| 92 | |
| 93 | ## Output And Evidence |
| 94 | |
| 95 | - Save artifacts, command outputs, and API response summaries under `output/aliyun-zimage-turbo/`. |
| 96 | - Include key parameters (region/resource id/time range) in evidence files for reproducibility. |
| 97 | |
| 98 | ## Workflow |
| 99 | |
| 100 | 1) Confirm user intent, region, identifiers, and whether the operation is read-only or mutating. |
| 101 | 2) Run one minimal read-only query first to verify connectivity and permissions. |
| 102 | 3) Execute the target operation with explicit parameters and bounded scope. |
| 103 | 4) Verify results and save output/evidence files. |
| 104 | |
| 105 | ## References |
| 106 | |
| 107 | - `references/api_reference.md` for request/response schema and regional endpoints. |
| 108 | - `references/sources.md` for official docs. |