About zimage-generation
zimage-generation is a skill for generating images with the Z-Image model through the ModelScope Inference API. It provides a Python script with prompt, output, model, and API-key options.
Key features
- 01Z-Image image generation
- 02ModelScope Inference API access
- 03Python script for API requests
- 04Prompt, output, and model options
- 05Several API-key configuration methods
Use cases
- 01Generating an image from a text prompt
- 02Saving generated images to a chosen filename
- 03Running image generation with a configured ModelScope key
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ toolsai/ free-zimage-skills --skill zimage-generationAfter installing, type/zimage-generationin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
.DS_Store.gitignoreREADME.mdscripts/.DS_Store.env.examplegenerate_zimage.pyDetails
From the project READMEZ-Image Generation Skill
This skill allows you to generate images using the Z-Image model via the ModelScope Inference API.
When to Use
Use this skill when:
- The user requests to generate an image using "Zimage", "zimage:", or "ModelScope".
- The user inputs a command like
zimage: <prompt>orzimage <prompt>. - The user wants to use their configured ModelScope API key for image generation.
Usage
The skill provides a Python script scripts/generate_zimage.py to handle the API interaction.
Prerequisites
- Python 3 with
requestsinstalled. - API Key Setup (Choose one):
- Method A (Easiest for beginners): Open
scripts/generate_zimage.pyand paste your key into theDEFAULT_API_KEYvariable at the top. - Method B (Temporary): Pass via command line:
--api-key your_token - Method C (Recommended Project Setup): Create a new text file named
.envin the same folder as the script (scripts/).- Content of the file should be:
MODELSCOPE_API_TOKEN="your_key_here"
- Content of the file should be:
- Method A (Easiest for beginners): Open
Commands
To generate an image:
# If you used Method A (pasted key in file):
python3 /Users/promptcase/.gemini/antigravity/skills/zimage-generation/scripts/generate_zimage.py "Your descriptive prompt here"
# If you prefer command line (Method B):
python3 /Users/promptcase/.gemini/antigravity/skills/zimage-generation/scripts/generate_zimage.py "Your prompt" --api-key "your_key"
Arguments:
prompt: The text description of the image (required).--output,-o: Specify output filename (optional).--model: Specify a different model ID (optional).--api-key: API key (if not set in file or environment).
API Verification Note
If the script returns a 401 error mentioning "bind your Alibaba Cloud account", notify the user that they must log in to ModelScope (https://modelscope.cn/my/account) and bind their Alibaba Cloud account to enable API access. This is a one-time setup required by the platform.
Example
# To generate a cyberpunk city
python3 /Users/mattchan/.gemini/antigravity/skills/zimage-generation/scripts/generate_zimage.py "cyberpunk city, neon lights, rainy street, high detail"