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.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "coze-image" with this command: npx skills add pgyppp/coze-image

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:

VariableDescriptionDefault
IMAGE_API_TOKENCoze API authentication tokenRequired
IMAGE_API_URLCoze stream_run endpointhttps://6fj9k4p9x3.coze.site/stream_run
IMAGE_API_PROJECT_IDCoze project ID7621854258107039796
IMAGE_API_SESSION_IDCoze session IDmT8SQeCGgTMZNBsJEiRuN
IMAGE_API_TIMEOUTRequest timeout in seconds60

Parameters

ParameterTypeDescription
text or promptstringImage generation prompt (required)
api_tokenstringCoze API token (or use env var)
project_idstringCoze project ID (or use env var)
session_idstringCoze session ID (or use env var)
timeoutintRequest timeout in seconds
include_debugboolInclude debug info in response
strictboolRaise 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

  1. Install the skill via ClawHub:

    openclaw skills install coze-image
    
  2. Configure your API token:

    openclaw config set IMAGE_API_TOKEN your_token_here
    
  3. 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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Zhipu Image Generator

AI text-to-image generation using Zhipu AI's GLM-Image model. Use when the user requests image generation, creating images from text descriptions, or mention...

Registry SourceRecently Updated
3821Profile unavailable
General

Raphael Ai Image

通过输入文字提示词,使用 Raphael AI 免费生成高质量无水印图片,支持24种视觉风格和电商优化场景。

Registry SourceRecently Updated
1570Profile unavailable
General

Ms Ai

ModelScope AI 技能:生图、改图、析图、生文。支持文生图、图生图、视觉理解、文本生成,遇到限速自动轮换模型。

Registry SourceRecently Updated
1810Profile unavailable
General

3daistudio integration

Convert images and text prompts to 3D models (.glb) using the 3D AI Studio API. Supports TRELLIS.2, Hunyuan Rapid, and Hunyuan Pro models.

Registry SourceRecently Updated
3581Profile unavailable