coze-image
Generate images using Coze AI platform. Supports text-to-image generation with automatic Base64 encoding for inline preview. Use when you need to create images from text prompts.
- License 许可
- MIT
- 最近更新
- 2026-06-10
- Stars
- ★ 3
- Forks
- 0
01 前言 Front Matter
- name
- coze-image
- metadata
- { "clawhub": { "tags": [ "image", "generation", "coze", "ai", "text-to-image" ], "author": "OpenClaw Community", "license": "MIT", "version": "1.0.0", "repository": "https://github.com/openclaw/skills" }, "openclaw": { "env": [ { "name": "IMAGE_API_TOKEN", "required": true, "description": "Coze API authentication token" }, { "name": "IMAGE_API_URL", "default": "https://6fj9k4p9x3.coze.site/stream_run", "description": "Coze stream_run endpoint" }, { "name": "IMAGE_API_PROJECT_ID", "default": "7621854258107039796", "description": "Coze project ID" }, { "name": "IMAGE_API_SESSION_ID", "default": "mT8SQeCGgTMZNBsJEiRuN", "description": "Coze session ID" }, { "name": "IMAGE_API_TIMEOUT", "default": "60", "description": "Request timeout in seconds" } ] } }
- description
- Generate images using Coze AI platform. Supports text-to-image generation with automatic Base64 encoding for inline preview. Use when you need to create images from text prompts.
03 SKILL.md 正文
Coze Image Generation Skill
Generate images from text prompts using the Coze AI platform. This skill handles the complete workflow: submitting prompts, parsing SSE responses, downloading images, and returning Base64-encoded data URIs for inline display.
Usage
Basic Usage
from coze_image_skill import run
result = run({
"text": "一只可爱的小猫,毛茸茸的,大眼睛,坐在窗台上",
"api_token": "your_coze_api_token"
})
# Result contains:
# - image: data:image/jpeg;base64,... (inline Base64)
# - mime_type: image/jpeg
# - filename: generated-image.jpeg
# - source_url: original image URL
With Custom Configuration
result = run({
"prompt": "a cute orange cat playing on grass, sunny day",
"api_token": "your_token",
"project_id": "your_project_id",
"session_id": "your_session_id",
"timeout": 90,
"include_debug": True
})
Environment Variables
Set these in your OpenClaw configuration or .env file:
| Variable | Description | Default |
|---|---|---|
IMAGE_API_TOKEN |
Coze API authentication token | Required |
IMAGE_API_URL |
Coze stream_run endpoint | https://6fj9k4p9x3.coze.site/stream_run |
IMAGE_API_PROJECT_ID |
Coze project ID | 7621854258107039796 |
IMAGE_API_SESSION_ID |
Coze session ID | mT8SQeCGgTMZNBsJEiRuN |
IMAGE_API_TIMEOUT |
Request timeout in seconds | 60 |
Parameters
| Parameter | Type | Description |
|---|---|---|
text or prompt |
string | Image generation prompt (required) |
api_token |
string | Coze API token (or use env var) |
project_id |
string | Coze project ID (or use env var) |
session_id |
string | Coze session ID (or use env var) |
timeout |
int | Request timeout in seconds |
include_debug |
bool | Include debug info in response |
strict |
bool | Raise exceptions instead of returning error object |
Response Format
Success
{
"image": "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
"mime_type": "image/jpeg",
"filename": "generated-image.jpeg",
"source_url": "https://..."
}
Error
{
"error": "Error message describing what went wrong",
"image": null,
"mime_type": null,
"filename": null,
"source_url": null
}
Features
- SSE Streaming: Handles Coze's Server-Sent Events response format
- Auto Download: Automatically downloads generated images and converts to Base64
- Error Handling: Graceful error handling with structured error responses
- Flexible Auth: Supports both inline token and environment variables
- Debug Mode: Optional debug output for troubleshooting
Setup on ClawHub
-
Install the skill via ClawHub:
openclaw skills install coze-image -
Configure your API token:
openclaw config set IMAGE_API_TOKEN your_token_here -
Generate your first image:
Generate a picture of a sunset over the ocean
Troubleshooting
"Image URL not found in SSE response"
This means the Coze project returned text instead of an image. Make sure:
- Your Coze bot has an image generation plugin enabled
- The workflow is configured to return images
- The prompt is appropriate for image generation
Authentication Errors
- Verify your API token is valid and not expired
- Check that the token has permission to access the project
- Ensure environment variables are set correctly
Timeout Errors
- Increase the timeout parameter (default 60s)
- Check your network connection
- The image generation may be taking longer than expected
License
MIT License - See license file for details.
Support
For issues or questions, please open an issue on the ClawHub repository.
04 同仓库更多 Skills
youtube-content
YouTube transcripts to summaries, threads, blogs.
xurl
X/Twitter via xurl CLI: post, search, DM, media, v2 API.
touchdesigner-mcp
Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.
test-driven-development
TDD: enforce RED-GREEN-REFACTOR, tests before code.
teams-meeting-pipeline
Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.
systematic-debugging
4-phase root cause debugging: understand bugs before fixing.