Loading...
Loading...
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.
npx skill4agent add zai-org/glm-skills glm-image-gen| Resource | Link |
|---|---|
| Get API Key | 智谱开放平台 API Keys |
| API Docs | Image Generation / 图像生成 |
| Model Docs | GLM-Image 模型文档 |
ZHIPU_API_KEYZHIPU_API_KEYopenclaw.jsonenv.vars{
"env": {
"vars": {
"ZHIPU_API_KEY": "你的密钥"
}
}
}openclaw.json{
"skills": {
"entries": {
"glm-image-generation": {
"env": {
"ZHIPU_API_KEY": "你的密钥"
}
}
}
}
}~/.zshrc export ZHIPU_API_KEY="你的密钥"
💡 如果你已为其他智谱 skill(如、glmocr)配置过 key,它们共享同一个glmv-caption,无需重复配置。ZHIPU_API_KEY
ZHIPU_API_KEYhttps://open.bigmodel.cn/api/paas/v4/images/generationspython scripts/glm_image_cli.pypython scripts/glm_image_cli.py --prompt "一只可爱的小猫咪,坐在阳光明媚的窗台上,背景是蓝天白云"python scripts/glm_image_cli.py --prompt "赛博朋克风格的城市夜景" --size 1568x1056python scripts/glm_image_cli.py --prompt "中国山水画风格,远山近水,云雾缭绕" --quality hdpython scripts/glm_image_cli.py --prompt "商业设计素材" --no-watermarkpython scripts/glm_image_cli.py --prompt "中国水墨画风格" --save image.png
python scripts/glm_image_cli.py --prompt "赛博朋克城市" --size 1728x960 --save ~/Pictures/cyberpunk.pngpython scripts/glm_image_cli.py --prompt "..." --user-id "user_12345"python scripts/glm_image_cli.py --prompt "..." --model glm-image
python scripts/glm_image_cli.py --prompt "..." --model cogview-4python {baseDir}/scripts/glm_image_cli.py --prompt TEXT [--model MODEL] [--size SIZE] [--quality QUALITY] [--no-watermark] [--user-id ID] [--save FILE]| Parameter | Required | Description |
|---|---|---|
| Yes | Text description of the desired image / 图片的文本描述 |
| No | Model: glm-image (default), cogview-4, cogview-3-flash / 模型 |
| No | Image size (default: 1280x1280) / 图片尺寸 |
| No | Quality: hd (default) or standard / 质量 |
| No | Disable watermark (requires signed disclaimer) / 关闭水印 |
| No | End-user ID for content moderation (6-128 chars) / 终端用户 ID |
| No | Save generated image to local file / 保存生成的图片到本地文件 |
| 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 |
{
"created": 123,
"data": [
{
"url": "<string>"
}
],
"content_filter": [
{
"role": "assistant",
"level": 1
}
]
}{
"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
}okmodelimage_urldata[0].urlpromptsizequalitycreatedcontent_filterrolelevelsaved_file--saveerrorcontent_filterrolelevel{
"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"
}
}{
"ok": false,
"error": {
"code": "authentication_error",
"message": "令牌已过期或验证不正确",
"status": 401
}
}{
"ok": false,
"error": {
"code": "rate_limit_exceeded",
"message": "API rate limit exceeded. Please try again later.",
"status": 429
}
}{
"ok": false,
"error": {
"code": "content_filter_violation",
"message": "Content safety check failed",
"status": 400
}
}{
"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"
}
}{
"ok": false,
"error": {
"code": "DOWNLOAD_FAILED",
"message": "Failed to download image to image.png"
}
}{
"ok": false,
"error": {
"code": "NETWORK_ERROR",
"message": "Network error: [Errno 8] nodename nor servname provided, or not known"
}
}