Generate images using ModelScope Z-Image models (Z-Image-Turbo, Z-Image, Z-Image-Edit). Use when user asks to generate images, create artwork, or requests image generation functionality. Supports async generation with polling and optional LoRA configurations. IMPORTANT - Model Selection Rule: If the user explicitly mentions "Z-Image-Turbo" in their prompt, use "Tongyi-MAI/Z-Image-Turbo"; if they explicitly mention "Z-Image" (without Turbo), use "Tongyi-MAI/Z-Image"; otherwise, use the default "Tongyi-MAI/Z-Image-Turbo".
A skill for coding agents such as Claude Code that generates images with the ModelScope Z-Image series.
0o600 permissions| Model | Description |
|------|------|
| Tongyi-MAI/Z-Image-Turbo | Default, optimized for speed |
| Tongyi-MAI/Z-Image | Better balance between quality and speed |
Tongyi-MAI/Z-Image-TurboTongyi-MAI/Z-ImageTongyi-MAI/Z-Image-Turbonpx skills add haiyuan-ai/agent-skills --skill modelscope-zimage-generator
# Clone or copy the skill directory
cp -r modelscope-zimage-generator ~/.claude/skills/
Get your API key from https://modelscope.cn/my/myaccesstoken.
On first use, the script prompts for an API key and can save it to a config file.
Config file:
mkdir -p ~/.config/modelscope
cat > ~/.config/modelscope/config.json << EOF
{"api_key": "ms-your-api-key"}
EOF
chmod 600 ~/.config/modelscope/config.json
Environment variable:
export MODELSCOPE_API_KEY="ms-your-api-key"
Describe the request in natural language:
Generate an image of a golden cat
Use Z-Image to generate a cyberpunk city at night
Create a cover image for an article about AI technology
# Use the default model
python scripts/generate_image.py "A golden cat" output.jpg
# Specify a model
python scripts/generate_image.py "A cat" output.jpg --model "Tongyi-MAI/Z-Image"
# Use a single LoRA
python scripts/generate_image.py "A cat" output.jpg --lora "liuhaotian/llava-lora"
# Use multiple LoRAs
python scripts/generate_image.py "A cat" output.jpg --loras '{"lora1": 0.6, "lora2": 0.4}'
| Request | Command |
|---------|------|
| Generate an image | python scripts/generate_image.py "prompt" output.jpg |
| Use Z-Image | python scripts/generate_image.py "prompt" output.jpg --model "Tongyi-MAI/Z-Image" |
| Use LoRA | python scripts/generate_image.py "prompt" output.jpg --lora "lora-id" |
| Generate in parallel | Run multiple commands in the background and use wait |
references/api-reference.md - Full API parameter referencereferences/lora-config.md - LoRA configuration guidereferences/troubleshooting.md - Troubleshooting guide1. POST /v1/images/generations (X-ModelScope-Async-Mode: true)
-> returns task_id
2. GET /v1/tasks/{task_id} (X-ModelScope-Task-Type: image_generation)
-> poll until SUCCEED or FAILED
3. Download output_images[0] and save it locally
# Set an environment variable
export MODELSCOPE_API_KEY="ms-your-key"
# Or create a config file
mkdir -p ~/.config/modelscope
echo '{"api_key": "ms-your-key"}' > ~/.config/modelscope/config.json
pip install requests pillow
See references/troubleshooting.md for more details.
MIT License
npx skills add haiyuan-ai/modelscope-zimage-生成器下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Generate or edit images via Gemini 3 Pro Image (Nano Banana Pro).
Batch-generate images via OpenAI Images API. Random prompt sampler + `index.html` gallery.
Generate spectrograms and feature-panel visualizations from audio with the songsee CLI.
Extract frames or short clips from videos using ffmpeg.
Search GIF providers with CLI/TUI, download results, and extract stills/sheets.
Category:media-generate