imagegen

GitHub

通过 ClawRouter API 生成或编辑图像,支持多种模型选择与自动支付。提供文本转图片及局部重绘功能,适配不同分辨率与质量需求。

skills/imagegen/SKILL.md BlockRunAI/ClawRouter

Trigger Scenarios

用户要求生成、创建、绘制图片 用户要求编辑、修改、润色现有图片

Install

npx skills add BlockRunAI/ClawRouter --skill imagegen -g -y
More Options

Use without installing

npx skills use BlockRunAI/ClawRouter@imagegen

指定 Agent (Claude Code)

npx skills add BlockRunAI/ClawRouter --skill imagegen -a claude-code -g -y

安装 repo 全部 skill

npx skills add BlockRunAI/ClawRouter --all -g -y

预览 repo 内 skill

npx skills add BlockRunAI/ClawRouter --list

SKILL.md

Frontmatter
{
    "name": "imagegen",
    "metadata": {
        "openclaw": {
            "emoji": "🖼️",
            "requires": {
                "config": [
                    "models.providers.blockrun"
                ]
            }
        }
    },
    "triggers": [
        "blockrun image",
        "blockrun image generation",
        "clawrouter image",
        "generate image via blockrun",
        "blockrun ai art",
        "blockrun seedream",
        "blockrun nano banana",
        "blockrun cogview",
        "blockrun grok imagine",
        "edit image via blockrun",
        "inpainting via blockrun",
        "x402 image generation",
        "usdc image generation"
    ],
    "description": "Generate or edit images via BlockRun's image API. Trigger when the user asks to generate, create, draw, make an image — or to edit, modify, change, or retouch an existing image."
}

Image Generation & Editing

Generate or edit images through ClawRouter. Payment is automatic via x402.

Shortcuts:

  • Slash: /cr-imagegen <prompt> [--model=<alias>] [--size=1024x1024] [--n=1] (/imagegen still accepted in chat for backward compatibility)
  • Partner tool: blockrun_image_generation (LLM-callable) / blockrun_image_edit (inpainting)

Generate an Image

POST to http://localhost:8402/v1/images/generations:

{
  "model": "google/nano-banana",
  "prompt": "a golden retriever surfing on a wave",
  "size": "1024x1024",
  "n": 1
}

Response:

{
  "created": 1741460000,
  "data": [{ "url": "http://localhost:8402/images/abc123.png" }]
}

Display inline: ![generated image](http://localhost:8402/images/abc123.png)

Model Selection

Alias Full ID Price Sizes Best for
nano-banana google/nano-banana $0.05 1024×1024 Default — fast, cheap, good quality
banana-2 google/nano-banana-2 $0.09 1024×1024 Gemini 3.1 Flash imagegen — sharper than nano-banana at 1K
banana-pro google/nano-banana-pro $0.10–$0.15 1024×1024, 2048×2048, 4096×4096 High-res, large format
gpt-image openai/gpt-image-1 $0.02–$0.04 1024×1024, 1536×1024, 1024×1536 Budget option; supports editing
gpt-image-2 openai/gpt-image-2 $0.06–$0.12 1024×1024, 1536×1024, 1024×1536 Photorealistic, reasoning-driven, text rendering (slow — proxy polls up to 5min); legacy dalle alias routes here
seedream bytedance/seedream-5-pro $0.045–$0.09 up to 2848×1600 / 2304×1728 Flagship quality, reference-image support
grok-imagine xai/grok-imagine-image $0.02 1024×1024 xAI Grok image style
grok-imagine-pro xai/grok-imagine-image-pro $0.07 1024×1024 Grok high-quality
cogview zai/cogview-4 $0.015–$0.02 512×512 to 1440×1440 Cheapest — Zhipu CogView

Choosing a model:

  • Default → nano-banana
  • "high res" / "large" → banana-pro
  • "photorealistic" / complex scenes → gpt-image-2
  • "flagship quality" / reference image → seedream
  • "budget" / "cheap" → cogview
  • "editable" / "inpainting" → gpt-image (only edit-capable model)
  • "artistic" / flexible content → grok-imagine
  • "grok style" → grok-imagine or grok-imagine-pro

Choosing a size:

  • Default: 1024x1024 (the only size every model accepts)
  • Portrait: 1024x1536 (gpt-image / gpt-image-2) or 1728x2304 (seedream)
  • Landscape: 1536x1024 (gpt-image / gpt-image-2), 1344x768 (cogview), or 2048x1024 / 1280x720 (seedream)
  • High-res: 2048x2048 / 4096x4096 with banana-pro; 2848x1600 with seedream
  • The gateway validates size per model BEFORE payment and rejects unknown ones — do not invent sizes outside each model's list above

Edit an Existing Image

POST to http://localhost:8402/v1/images/image2image:

{
  "model": "openai/gpt-image-1",
  "prompt": "make the background a snowy mountain landscape",
  "image": "https://example.com/photo.jpg",
  "size": "1024x1024",
  "n": 1
}

ClawRouter automatically downloads URLs and reads local file paths — pass them directly, no manual base64 conversion needed.

Optional mask field: a second image (URL or path) that marks which areas to edit (white = edit, black = keep).

Response is identical to generation:

{
  "created": 1741460000,
  "data": [{ "url": "http://localhost:8402/images/xyz456.png", "revised_prompt": "..." }]
}

Supported models for editing: openai/gpt-image-1 only ($0.02)


Example Interactions

User: Draw me a cyberpunk city at night → POST to /v1/images/generations, model nano-banana, prompt as given.

User: Generate a high-res portrait of a samurai → POST to /v1/images/generations, model seedream, size 1728x2304.

User: Edit this photo to add a sunset background: https://example.com/portrait.jpg → POST to /v1/images/image2image, model gpt-image, image = the URL, prompt = "add a warm sunset background".

User: Change the background in my image to a beach (attaches local file) → POST to /v1/images/image2image, image = the local file path, prompt describes the change.


Notes

  • Payment is automatic via x402 — deducted from the user's BlockRun wallet
  • If the call fails with a payment error, tell the user to fund their wallet at blockrun.ai
  • Google models may return base64 internally — ClawRouter uploads automatically and returns a hosted URL
  • OpenAI image models enforce OpenAI content policy; use nano-banana or grok-imagine for more flexibility
  • Image editing is only available with gpt-image-1; generation supports all listed models

Version History

  • e50ba2e Current 2026-08-28 18:54

    修复202轮询逻辑以支持慢速模型,同步并修正支持的尺寸列表,移除无效尺寸,增加Seedream尺寸,优化模型别名安全性。

  • 334bd97 2026-08-20 08:04

Same Skill Collection

skills/phone/SKILL.md
skills/polymarket-trading/SKILL.md
skills/predexon/SKILL.md
skills/release/SKILL.md
skills/surf/SKILL.md
skills/clawrouter/SKILL.md

Metadata

Files
0
Version
e50ba2e
Hash
39663f6e
Indexed
2026-08-20 08:04

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-30 23:48
浙ICP备14020137号-1 $Carte des visiteurs$