glm-image-gen
Official skill for generating high-quality images from text prompts using ZhiPu GLM-Image API. Excellent at scientific illustrations, high-quality portraits, social media graphics, and commercial posters. Supports multiple aspect ratios, HD quality, and watermark control. Use this skill when the user wants to generate images, create AI art, text-to-image, or convert text descriptions into visual content.
- Installs
- 357
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://modelscope.cn --skill glm-image-gen- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads glm-image-gen automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
GLM-Image Generation Skill / GLM-Image 图片生成技能
Generate high-quality images from text prompts using the ZhiPu GLM-Image API.
When to Use / 使用场景
- Generate images from text descriptions / 从文字描述生成图片
- Create AI art, illustrations, or concept art / 创作 AI 艺术、插画或概念图
- User mentions "生图", "文生图", "AI 绘画", "generate image", "text-to-image", "create image"
- User provides a prompt and wants to see it visualized / 用户提供描述并想看到可视化效果
Key Features / 核心特性
- High-quality generation: HD mode produces more detailed, refined images (~20s)
- Multiple aspect ratios: Square, portrait, landscape formats supported
- GLM-Image model: Latest model with improved understanding and quality
- Excellent at: Scientific illustrations (科普插画), high-quality portraits (高质量人像), social media graphics (社交媒体图文), commercial posters (商业海报)
- Watermark control: Enable/disable watermarks (requires signed disclaimer for no-watermark)
- Content safety: Built-in content filtering for compliance
Resource Links / 资源链接
| Resource | Link |
|---|---|
| Get API Key | 智谱开放平台 API Keys |
| API Docs | Image Generation / 图像生成 |
| Model Docs | GLM-Image 模型文档 |
Prerequisites / 前置条件
API Key Setup / API Key 配置(Required / 必需)
脚本通过 ZHIPU_API_KEY 环境变量获取密钥,可与其他智谱技能复用同一个 key。
This script reads the key from the ZHIPU_API_KEY environment variable. Reusing the same key across Zhipu skills is optional.
Get Key / 获取 Key: Visit 智谱开放平台 API Keys to create or copy your key.
Setup options / 配置方式(任选一种):
-
Global config (recommended) / 全局配置(推荐): Set once in
openclaw.jsonunderenv.vars, all Zhipu skills will share it:{ "env": { "vars": { "ZHIPU_API_KEY": "你的密钥" } } } -
Skill-level config / Skill 级别配置: Set for this skill only in
openclaw.json:{ "skills": { "entries": { "glm-image-generation": { "env": { "ZHIPU_API_KEY": "你的密钥" } } } } } -
Shell environment variable / Shell 环境变量: Add to
~/.zshrc:export ZHIPU_API_KEY="你的密钥"
💡 如果你已为其他智谱 skill(如
glmocr、glmv-caption)配置过 key,它们共享同一个ZHIPU_API_KEY,无需重复配置。
Security & Transparency / 安全与透明度
- Environment variables used / 使用的环境变量:
ZHIPU_API_KEY(required / 必需)
- Fixed endpoint / 固定官方端点:
https://open.bigmodel.cn/api/paas/v4/images/generations - No custom API URL override / 不支持自定义 API URL 覆盖: avoids accidental key exfiltration via redirected endpoints.
⛔ MANDATORY RESTRICTIONS / 强制限制 ⛔
- ONLY use GLM-Image API — Execute the script
python scripts/glm_image_cli.py - NEVER generate images yourself — Do NOT try to create images using built-in vision or any other method
- NEVER offer alternatives — Do NOT suggest "I can try to describe it" or similar
- IF API fails — Display the error message and STOP immediately
- NO fallback methods — Do NOT attempt image generation any other way
📋 Output Display Rules / 输出展示规则
After running the script, present the generation result clearly.
- Show the generated image URL(s) — images are temporary (30 days), remind user to save
- Display the prompt used and generation parameters (size, quality)
- If content_filter indicates issues, show the warning level
⚠️ Image Display / 图片展示注意:
The API returns a temporary image URL (valid for 30 days). You should:
- Show the image — Use the URL to display the image in the chat (if platform supports it)
- Remind user to save — "图片链接有效期 30 天,请及时下载保存"
- Offer to send to Feishu — If user wants the image sent to a Feishu chat, use the message tool with the image URL
How to Use / 使用方法
Generate from Prompt / 从提示词生成
python scripts/glm_image_cli.py --prompt "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"
Specify Size / 指定尺寸
python scripts/glm_image_cli.py --prompt "赛博朋克风格的城市夜景" --size 1568x1056
HD Quality (default for glm-image) / 高清质量(glm-image 默认)
python scripts/glm_image_cli.py --prompt "中国山水画风格,远山近水,云雾缭绕" --quality hd
Disable Watermark (requires signed disclaimer) / 关闭水印(需签署免责声明)
python scripts/glm_image_cli.py --prompt "商业设计素材" --no-watermark
Save Image to Local File / 保存图片到本地
python scripts/glm_image_cli.py --prompt "中国水墨画风格" --save image.png
python scripts/glm_image_cli.py --prompt "赛博朋克城市" --size 1728x960 --save ~/Pictures/cyberpunk.png
Specify User ID (for content moderation) / 指定用户 ID(用于内容审核)
python scripts/glm_image_cli.py --prompt "..." --user-id "user_12345"
Specify Model / 指定模型
python scripts/glm_image_cli.py --prompt "..." --model glm-image
python scripts/glm_image_cli.py --prompt "..." --model cogview-4
CLI Reference / CLI 参数
python {baseDir}/scripts/glm_image_cli.py --prompt TEXT [--model MODEL] [--size SIZE] [--quality QUALITY] [--no-watermark] [--user-id ID] [--save FILE]
| Parameter | Required | Description |
|---|---|---|
--prompt, -p | Yes | Text description of the desired image / 图片的文本描述 |
--model, -m | No | Model: glm-image (default), cogview-4, cogview-3-flash / 模型 |
--size, -s | No | Image size (default: 1280x1280) / 图片尺寸 |
--quality, -q | No | Quality: hd (default) or standard / 质量 |
--no-watermark | No | Disable watermark (requires signed disclaimer) / 关闭水印 |
--user-id | No | End-user ID for content moderation (6-128 chars) / 终端用户 ID |
--save | No | Save generated image to local file / 保存生成的图片到本地文件 |
Supported Sizes / 支持的尺寸
GLM-Image recommended sizes:
| Size | Aspect Ratio | Use Case |
|---|---|---|
| 1280x1280 | 1:1 | Square (default) |
| 1568×1056 | 3:2 | Landscape / 横向 |
| 1056×1568 | 2:3 | Portrait / 纵向 |
| 1472×1088 | ~4:3 | Wide landscape |
| 1088×1472 | ~3:4 | Tall portrait |
| 1728×960 | 16:9 | Ultra-wide landscape |
| 960×1728 | 9:16 | Ultra-tall portrait |
Custom sizes / 自定义尺寸:
- Width and height: 1024px - 2048px
- Both dimensions must be multiples of 32 / 长宽均需为 32 的整数倍
- Maximum total pixels: 2^22 (4,194,304 px) / 最大像素数不超过 2^22
Response Format / 响应格式
Official API Response:
{
"created": 123,
"data": [
{
"url": "<string>"
}
],
"content_filter": [
{
"role": "assistant",
"level": 1
}
]
}
CLI Output Format:
{
"ok": true,
"model": "glm-image",
"image_url": "https://open.bigmodel.cn/.../generated_image.png",
"prompt": "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云",
"size": "1280x1280",
"quality": "hd",
"created": 1710835200,
"content_filter": [
{
"role": "assistant",
"level": 3
}
],
"saved_file": "/Users/xxx/image.png",
"error": null
}
Key fields:
ok— whether generation succeededmodel— model used for generationimage_url— extracted fromdata[0].url, temporary URL (valid 30 days)prompt— the text prompt usedsize— generated image dimensionsquality— hd or standardcreated— Unix timestamp when request was createdcontent_filter— content safety analysis array (may be empty)role: where the issue was detected (user/assistant/history)level: severity 0-3 (0 = most severe, 3 = minor)
saved_file— absolute path to saved local file (if--savewas used)error— error details on failure
Content Safety / 内容安全
The API includes content filtering. If issues are detected, content_filter will contain entries with:
role: where the issue was detected (user/assistant/history)level: severity 0-3 (0 = most severe, 3 = minor)
If level 0-1 detected: Generation will fail, show error to user. If level 2-3 detected: Generation may succeed, but warn user about potential issues.
Error Handling / 错误处理
API key not configured:
{
"ok": false,
"error": {
"code": "MISSING_API_KEY",
"message": "ZHIPU_API_KEY not configured. Get your API key at: https://bigmodel.cn/usercenter/proj-mgmt/apikeys"
}
}
→ Show exact error to user, guide them to configure
Authentication failed (401/403):
{
"ok": false,
"error": {
"code": "authentication_error",
"message": "令牌已过期或验证不正确",
"status": 401
}
}
→ API key invalid/expired → reconfigure
Rate limit (429):
{
"ok": false,
"error": {
"code": "rate_limit_exceeded",
"message": "API rate limit exceeded. Please try again later.",
"status": 429
}
}
→ Quota exhausted → inform user to wait or check quota
Content filter violation:
{
"ok": false,
"error": {
"code": "content_filter_violation",
"message": "Content safety check failed",
"status": 400
}
}
→ Explain that the prompt may contain inappropriate content
Invalid size:
{
"ok": false,
"error": {
"code": "INVALID_SIZE",
"message": "Invalid size: 512x512 for model glm-image. Must be multiple of 32, 1024-2048px, max 2^22 pixels"
}
}
→ Guide user to use valid size from the supported list
Download failed:
{
"ok": false,
"error": {
"code": "DOWNLOAD_FAILED",
"message": "Failed to download image to image.png"
}
}
→ Check file path permissions and disk space
Network error:
{
"ok": false,
"error": {
"code": "NETWORK_ERROR",
"message": "Network error: [Errno 8] nodename nor servname provided, or not known"
}
}
→ Check internet connection
Prompt Tips / 提示词技巧
Good prompts:
- Specific details: "一只橘色的英国短毛猫,绿色眼睛,坐在木质窗台上"
- Style keywords: "赛博朋克风格", "中国水墨画", "油画质感", "3D 渲染"
- Lighting: "阳光明媚", "柔和的逆光", "电影感灯光"
- Composition: "特写镜头", "广角视角", "俯视角度"
Avoid:
- Vague descriptions: "好看的图片"
- Contradictory elements: "白天和夜晚同时"
- Too many subjects: Keep focus on 1-2 main elements
FAQ
What does the glm-image-gen skill do?
Official skill for generating high-quality images from text prompts using ZhiPu GLM-Image API. Excellent at scientific illustrations, high-quality portraits, social media graphics, and commercial posters. Supports multiple aspect ratios, HD quality, and watermark control. Use this skill when the user wants to generate images, create AI art, text-to-image, or convert text descriptions into visual content.
How do I install glm-image-gen?
Run npx skills add https://modelscope.cn --skill glm-image-gen in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/glm-image-gen/ (personal) or .claude/skills/glm-image-gen/ (project).
Which AI agents can use glm-image-gen?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is glm-image-gen safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains glm-image-gen?
It is published by modelscope.cn in modelscope.cn. It has 357 recorded installs.
More from modelscope.cn
skill-creator
modelscope.cn
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
frontend-design
modelscope.cn
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
pptx-generator
modelscope.cn
Generate, edit, and read PowerPoint presentations. Create from scratch with PptxGenJS (cover, TOC, content, section divider, summary slides), edit existing PPTX via XML workflows, or extract text with markitdown. Triggers: PPT, PPTX, PowerPoint, presentation, slide, deck, slides.
minimax-docx
modelscope.cn
Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: (A) create new documents from scratch, (B) fill/edit content in existing documents, (C) apply template formatting with XSD validation gate-check. MUST use this skill whenever the user wants to produce, modify, or format a Word document — including when they say "write a report", "draft a proposal", "make a contract", "fill in this form", "reformat to match this template", or any task whose final output is a .docx file. Even if the user doesn't mention "docx" explicitly, if the task implies a printable/formal document, use this skill.
minimax-pdf
modelscope.cn
Use this skill when visual quality and design identity matter for a PDF. CREATE (generate from scratch): "make a PDF", "generate a report", "write a proposal", "create a resume", "beautiful PDF", "professional document", "cover page", "polished PDF", "client-ready document". FILL (complete form fields): "fill in the form", "fill out this PDF", "complete the form fields", "write values into PDF", "what fields does this PDF have". REFORMAT (apply design to an existing doc): "reformat this document", "apply our style", "convert this Markdown/text to PDF", "make this doc look good", "re-style this PDF". This skill uses a token-based design system: color, typography, and spacing are derived from the document type and flow through every page. The output is print-ready. Prefer this skill when appearance matters, not just when any PDF output is needed.
minimax-xlsx
modelscope.cn
Open, create, read, analyze, edit, or validate Excel/spreadsheet files (.xlsx, .xlsm, .csv, .tsv). Use when the user asks to create, build, modify, analyze, read, validate, or format any Excel spreadsheet, financial model, pivot table, or tabular data file. Covers: creating new xlsx from scratch, reading and analyzing existing files, editing existing xlsx with zero format loss, formula recalculation and validation, and applying professional financial formatting standards. Triggers on 'spreadsheet', 'Excel', '.xlsx', '.csv', 'pivot table', 'financial model', 'formula', or any request to produce tabular data in Excel format.
Popular media & creative skills
hyperframes
heygen-com/hyperframes
Read first to make, edit, animate or render any video with HyperFrames (HTML rendered to video), including launch films, explainers, music videos, charts, maps, vertical clips, title cards, captions and overlays. Holds the render contract, the work loop and what each kind of video needs.
media-use
heygen-com/hyperframes
Get or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.
hyperframes-registry
heygen-com/hyperframes
About 450 ready-made HyperFrames blocks and components installed as editable source - transitions, overlays, titles, kinetic type, captions, charts, map overlays, 3D, camera moves. Use it before hand-building any named visual (CRT scanlines, glitch, film grain, a chart); also for hyperframes add and catalog.
hyperframes-creative
heygen-com/hyperframes
Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use hyperframes-animation.
ai-video-generation
101-skills/superpowers
Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0, HappyHorse 1.0, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, reference-to-video, video editing, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative, seedance, happyhorse
ai-image-generation
101-skills/superpowers
Generate AI images with GPT-Image-2, FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: GPT-Image-2, FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image, gpt image, openai image, chatgpt image