modelscope
Use this skill to generate AI images using ModelScope's Tongyi-MAI/Z-Image-Turbo model. Simply describe the image you want and it will be generated. Supports Chinese and English prompts.
Best use case
modelscope is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use this skill to generate AI images using ModelScope's Tongyi-MAI/Z-Image-Turbo model. Simply describe the image you want and it will be generated. Supports Chinese and English prompts.
Teams using modelscope should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/modelscope/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How modelscope Compares
| Feature / Agent | modelscope | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use this skill to generate AI images using ModelScope's Tongyi-MAI/Z-Image-Turbo model. Simply describe the image you want and it will be generated. Supports Chinese and English prompts.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# ModelScope Image Generation Skill Generate AI images using ModelScope's powerful text-to-image model. ## When to Use This Skill Trigger when user: - Asks to generate an image - Wants to create a picture from description - Says "生成图片" or "画一个..." - Mentions ModelScope image generation - Uses phrases like "create an image", "generate a picture" ## Quick Start ```bash # Generate an image with a text prompt python scripts/run.py generate.py --prompt "A golden cat sitting on a windowsill" # Generate with Chinese prompt python scripts/run.py generate.py --prompt "一只金色的猫坐在窗台上,阳光照进来" # Generate and save to specific path python scripts/run.py generate.py --prompt "A beautiful sunset over mountains" --save-path "sunset.png" # Generate with custom model python scripts/run.py generate.py --prompt "Cyberpunk city at night" --model "Tongyi-MAI/Z-Image" ``` ## Configuration (One-Time Setup) ### Step 1: Set your API Key Create a `.env` file in the skill directory: ```bash MODELSCOPE_API_KEY=ms-your-api-key-here ``` Or set as environment variable: ```bash # Windows PowerShell $env:MODELSCOPE_API_KEY="ms-your-api-key-here" # Windows CMD set MODELSCOPE_API_KEY=ms-your-api-key-here # Linux/Mac export MODELSCOPE_API_KEY="ms-your-api-key-here" ``` ### Step 2: Install dependencies (automatic on first run) ```bash python scripts/run.py generate.py --help ``` This will automatically: - Create `.venv` virtual environment - Install required dependencies (requests, Pillow) ## Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `--prompt` | string | Yes | - | Text description of the image to generate | | `--model` | string | No | Tongyi-MAI/Z-Image-Turbo | Model ID to use | | `--save-path` | string | No | result_image.jpg | File path to save the image | | `--timeout` | integer | No | 300 | Maximum wait time in seconds | | `--async-mode` | boolean | No | true | Use async mode for generation | ## Examples ### Basic Usage ```bash # Simple image generation python scripts/run.py generate.py --prompt "A golden cat" ``` ### Advanced Usage ```bash # With custom save location python scripts/run.py generate.py --prompt "A majestic dragon" --save-path "dragon.png" # With longer timeout for complex images python scripts/run.py generate.py --prompt "A detailed fantasy landscape with castles and dragons" --timeout 600 # Using the standard quality model python scripts/run.py generate.py --prompt "A photorealistic portrait" --model "Tongyi-MAI/Z-Image" ``` ## How It Works 1. **Submit Request**: Sends prompt to ModelScope API with async mode enabled 2. **Get Task ID**: Receives a task ID for tracking 3. **Poll for Result**: Checks task status every 5 seconds 4. **Download Image**: When complete, downloads the generated image 5. **Save to File**: Saves to specified path (default: result_image.jpg) ## Available Models | Model ID | Description | Speed | Quality | |----------|-------------|-------|---------| | Tongyi-MAI/Z-Image-Turbo | Fast generation | Fast | Good | | Tongyi-MAI/Z-Image | Standard generation | Medium | High | ## Troubleshooting | Problem | Solution | |---------|----------| | `MODELSCOPE_API_KEY not set` | Set your API key in `.env` file or environment variable | | `Image generation failed` | Check your API key is valid and prompt follows content policies | | `Connection timeout` | Increase `--timeout` parameter (default: 300 seconds) | | `ModuleNotFoundError` | Dependencies will auto-install on first run, or manually run `pip install -r requirements.txt` | ## Tips for Better Results 1. **Be Descriptive**: More detailed prompts produce better images ``` "A golden cat" → "A fluffy golden cat with emerald eyes sitting on a velvet cushion" ``` 2. **Specify Style**: Include art style for better control ``` "A mountain landscape in the style of Studio Ghibli" ``` 3. **Use Chinese or English**: The model supports both languages well ``` "一只在月光下的猫,水彩画风格" ``` 4. **Add Details**: Include lighting, mood, and composition ``` "A serene sunset over calm ocean waters, warm orange and pink sky, peaceful atmosphere" ``` ## Data Storage - Generated images are saved to the current working directory or specified path - No user data is stored externally - API key is never shared or logged ## Limitations - Requires valid ModelScope API key - Generation time: 30-90 seconds typically - Max timeout: 600 seconds (10 minutes) - Image format: JPG by default (use .png extension for PNG) ## Skill Directory Structure ``` ~/.claude/skills/modelscope-image-gen/ ├── SKILL.md # This file - skill documentation ├── scripts/ │ ├── run.py # Wrapper script for environment management │ └── generate.py # Main image generation script ├── data/ # Local storage (auto-created) ├── .env # API key configuration (create this) ├── requirements.txt # Python dependencies └── .venv/ # Virtual environment (auto-created) ``` ## Resources - [ModelScope Documentation](https://modelscope.cn/) - [Tongyi-MAI Model Page](https://modelscope.cn/models/Tongyi-MAI/Z-Image-Turbo)
Related Skills
bgo
Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.
Prompt Engineering Skill
Craft effective prompts that get the best results from language models.
prompt-engineering-openai-api-f7c24501
Log in [Sign up](https://platform.openai.com/signup)
prompt-engineer-llm
World-class expert in prompt engineering, LLM fine-tuning, RAG systems, and AI/ML workflows. Use when crafting prompts, designing AI agents, building knowledge bases, implementing retrieval systems, or optimizing LLM performance at production scale.
project-spec
Create a project spec for AI agents to work from autonomously.
project-orchestrator
Master coordinator for complete project setup from ideation to ready-to-code. Manages workflow through ideation, research, tech stack selection, documentation, and project initialization to deliver working projects in minutes.
project-domain
Capture subject matter expertise and domain knowledge that will inform all product decisions - the ubiquitous language, domain rules, and principles from the field
project-bootstrap
Bootstrap a new or existing project with stack detection and project.json generation. Use when adding a new project, setting up agent system, or generating project manifest. Triggers on: add project, new project, bootstrap project, setup project, detect stack.
projecoes-read-models
Use para criar projeções como 9BOX, dashboards e visões de leitura otimizadas para decisão.
product-agent
Discover and validate product ideas, analyze markets, scope MVPs, and optimize app store presence for iOS/macOS apps. Use when user asks to discover, validate, assess, scope, or analyze product ideas, market opportunities, or when they mention "product agent", "app idea validation", "should I build this", "MVP", "market analysis", or "ASO".
private-vs-shared-components
Rules for determining if a component should be private or shared, and where to place them based on their use-case.
Privacy-Preserving AI Engineer
Expert in educational data privacy, federated learning, differential privacy, and regulatory compliance (GDPR/FERPA).