BA

baoyu-image-gen

Generates AI images using various top-tier models and APIs via a unified interface.

Install

mkdir -p .claude/skills/baoyu-image-gen && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1099" && unzip -o skill.zip -d .claude/skills/baoyu-image-gen && rm skill.zip

Installs to .claude/skills/baoyu-image-gen

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

AI image generation with OpenAI GPT Image 2, Azure OpenAI, Google, OpenRouter, DashScope, Z.AI GLM-Image, MiniMax, Jimeng, Seedream, Replicate and Agnes APIs. Supports text-to-image, reference images, aspect ratios, and batch generation from saved prompt files. Sequential by default; use batch parallel generation when the user already has multiple prompts or wants stable multi-image throughput. Use when user asks to generate, create, or draw images.
453 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Beginner

Key capabilities

  • Routes prompts to diverse generation models
  • Applies batch processing for multiple prompts
  • Handles aspect ratio adjustments via API parameters
  • Maintains session persistence for image style references
  • Integrates multi-vendor API providers

How it works

Uses a script-based runner to package prompts into API-specific payloads and executes sequential or parallel calls through the SDK.

Inputs & outputs

You give it
Text prompt, reference image URL, aspect ratio preference
You get back
Generated image file or URL

When to use baoyu-image-gen

  • Generate images from text
  • Create visual assets for projects
  • Use reference images for style transfer
  • Batch generate images

About this skill

Image Generation (AI SDK)

Official API-based image generation. Supports OpenAI GPT Image 2, Azure OpenAI, Google, OpenRouter, DashScope (阿里通义万象), Z.AI GLM-Image, MiniMax, Jimeng (即梦), Seedream (豆包), Replicate and Agnes.

User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

  1. Prefer built-in user-input tools exposed by the current agent runtime — e.g., AskUserQuestion, request_user_input, clarify, ask_user, or any equivalent.
  2. Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
  3. Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.

Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.

Script Directory

{baseDir} = this SKILL.md's directory. All scripts/... paths below are relative to {baseDir}. Main script: {baseDir}/scripts/main.ts. Batch payload helper: {baseDir}/scripts/build-batch.ts. Resolve ${BUN_X}: prefer bun; else npx -y bun; else suggest brew install oven-sh/bun/bun.

Step 0: Load Preferences ⛔ BLOCKING

This step MUST complete before any image generation — generation is blocked until EXTEND.md exists.

Check these paths in order; first hit wins:

PathScope
.baoyu-skills/baoyu-image-gen/EXTEND.mdProject
${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-image-gen/EXTEND.mdXDG
$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.mdUser home
  • Found → load, parse, apply. If default_model.[provider] is null → ask model only.
  • Not found → run first-time setup (references/config/first-time-setup.md) using AskUserQuestion to collect provider + model + quality + save location. Save EXTEND.md, then continue. Do not generate images before this completes.

Legacy compatibility: if .baoyu-skills/baoyu-imagine/EXTEND.md exists and the new path doesn't, the runtime renames it to baoyu-image-gen. If both exist, the runtime leaves them alone and uses the new path.

EXTEND.md keys: default provider, default quality, default aspect ratio, default image size, OpenAI image API dialect, default models, batch worker cap, provider-specific batch limits. Schema: references/config/preferences-schema.md.

Usage

Minimum working examples — see references/usage-examples.md for the full set including per-provider invocations and batch mode.

Identity-preserving reference prompts

When the user wants a real person/character/object preserved from reference images, do not replace the reference with a long generic description. Prefer short, hard identity-preservation language:

  • "Use the person/object in the reference image(s) as the same identity. Do not redesign it or create a similar-looking new subject."
  • "Only change scene, clothing, pose, lighting, rendering style, and composition. Keep the face/proportions/hair/key accessories/overall identity from the references."
  • If using multiple references, state that they are the same subject and should jointly define identity.

Pitfall: long descriptions like "young East Asian woman, oval face, clear eyes..." can cause the model to synthesize a new person matching the description instead of preserving the referenced person.

# Basic
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image cat.png

# With aspect ratio and high quality
${BUN_X} {baseDir}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9 --quality 2k

# Prompt from files
${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png

# With reference image
${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --ref source.png

# Specific provider
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider dashscope --model qwen-image-2.0-pro

# OpenAI GPT Image 2
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider openai --model gpt-image-2

# Codex CLI (uses logged-in Codex subscription — no OPENAI_API_KEY required; requires `codex` on PATH)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider codex-cli --ar 16:9

# Batch mode
${BUN_X} {baseDir}/scripts/main.ts --batchfile batch.json --jobs 4

# Build a batch file from outline.md + prompts/ (e.g. baoyu-article-illustrator output)
${BUN_X} {baseDir}/scripts/build-batch.ts --outline outline.md --prompts prompts --output batch.json --images-dir attachments
${BUN_X} {baseDir}/scripts/main.ts --batchfile batch.json --jobs 4

Reference-Image Identity Preservation

When the user wants a person/object preserved from reference images:

  • Prefer a small curated set of existing source references (usually 2–4) over many images; large multi-megabyte refs can destabilize streaming providers.
  • Make the prompt say the references are the same subject and the output must use that identity. Avoid long generic facial-feature descriptions that can cause the model to synthesize a new similar-looking person.
  • Do not use newly generated outputs as references unless the user explicitly asks; generated refs compound drift.
  • If results become too polished or influencer-like, reduce stylized refs and add explicit anti-beautification constraints (no face slimming, eye enlargement, heavy makeup, commercial travel shoot, over-smoothing).
  • If the subject should look younger/older, preserve the face and express age through clothing, posture, scene, and styling; do not ask the model to change facial identity.

Options

OptionDescription
--prompt <text>, -pPrompt text
--promptfiles <files...>Read prompt from files (concatenated)
--image <path>Output image path (required in single-image mode)
--batchfile <path>JSON batch file for multi-image generation
--jobs <count>Worker count for batch mode (default: auto, max from config, built-in default 10)
--provider google|openai|azure|openrouter|dashscope|zai|minimax|jimeng|seedream|replicate|codex-cli|agnesForce provider (default: auto-detect; codex-cli is never auto-selected — must be pinned via CLI or EXTEND.md)
--model <id>, -mModel ID — see provider references for defaults and allowed values
--ar <ratio>Aspect ratio (16:9, 1:1, 4:3, …)
--size <WxH>Explicit size (e.g., 1024x1024; for gpt-image-2, width/height must be multiples of 16, max edge 3840px, ratio no wider than 3:1)
--quality normal|2kQuality preset (default: 2k)
--imageSize 1K|2K|4KImage size for Google/OpenRouter (default: from quality)
--imageApiDialect openai-native|ratio-metadataOpenAI-compatible endpoint dialect — use ratio-metadata for gateways that expect aspect-ratio size plus metadata.resolution
--ref <files...>Reference images. Supported by Google multimodal, OpenAI GPT Image edits, Azure OpenAI edits (PNG/JPG only), OpenRouter multimodal models, Replicate supported families, MiniMax subject-reference, Seedream 5.0/4.5/4.0, DashScope wan2.7-image-pro/wan2.7-image. Not supported by Jimeng, Seedream 3.0, SeedEdit 3.0, or any DashScope model outside the wan2.7-image* family
--n <count>Number of images. Replicate requires --n 1 (single-output save semantics)
--jsonJSON output

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key
AZURE_OPENAI_API_KEYAzure OpenAI API key
OPENROUTER_API_KEYOpenRouter API key
GOOGLE_API_KEYGoogle API key
DASHSCOPE_API_KEYDashScope API key
ZAI_API_KEY (alias BIGMODEL_API_KEY)Z.AI API key
MINIMAX_API_KEYMiniMax API key
REPLICATE_API_TOKENReplicate API token
JIMENG_ACCESS_KEY_ID, JIMENG_SECRET_ACCESS_KEYJimeng (即梦) Volcengine credentials
ARK_API_KEYSeedream (豆包) Volcengine ARK API key
<PROVIDER>_IMAGE_MODELPer-provider model override (OPENAI_IMAGE_MODEL, GOOGLE_IMAGE_MODEL, DASHSCOPE_IMAGE_MODEL, ZAI_IMAGE_MODEL/BIGMODEL_IMAGE_MODEL, MINIMAX_IMAGE_MODEL, OPENROUTER_IMAGE_MODEL, REPLICATE_IMAGE_MODEL, JIMENG_IMAGE_MODEL, SEEDREAM_IMAGE_MODEL, AGNES_IMAGE_MODEL)
AZURE_OPENAI_DEPLOYMENT (alias AZURE_OPENAI_IMAGE_MODEL)Azure default deployment
<PROVIDER>_BASE_URLPer-provider endpoint override
AZURE_API_VERSIONAzure image API version (default 2025-04-01-preview)
JIMENG_REGIONJimeng region (default cn-north-1)
OPENAI_IMAGE_API_DIALECTopenai-native | ratio-metadata
OPENROUTER_HTTP_REFERER, OPENROUTER_TITLEOptional OpenRouter attribution
BAOYU_IMAGE_GEN_MAX_WORKERSOverride batch worker cap
BAOYU_IMAGE_GEN_<PROVIDER>_CONCURRENCYPer-provider concurrency (e.g., BAOYU_IMAGE_GEN_REPLICATE_CONCURRENCY; for codex-cli use BAOYU_IMAGE_GEN_CODEX_CLI_CONCURRENCY)
BAOYU_IMAGE_GEN_<PROVIDER>_START_INTERVAL_MSPer-provider start-gap
BAOYU_CODEX_IMAGEGEN_BINOverride the codex-imagegen wrapper path for the codex-cli provider (default: bundled scripts/codex-imagegen/main.ts; accepts .ts or legacy .sh/binary)
BAOYU_CODEX_IMAGEGEN_CACHE_DIREnable idempotency cache for the codex-cli provider (off by default)
BAOYU_CODEX_IMAGEGEN_TIMEOUT_MSPer-attempt codex exec timeout for the codex-cli provider (default: 300000 ms)
BAOYU_CODEX_IMAGEGEN_RETRIESWrapper-side retry attempts on retryable errors for the codex-cli provider (default: 2)
BAOYU_CODEX_IMAGEGEN_LOG_FILEAppend JSONL diagnostic log for the codex-cli provider

Load priority: CLI args > EXTEND.md > env vars > <cwd>/.baoyu-skills/.env > ~/.baoyu-skills/.env

Codex/ChatGPT OAuth is n


Content truncated.

When not to use it

  • Tasks requiring local image processing/editing
  • Situations where high-resolution vector output is mandatory
  • Applications needing strictly offline image rendering

Prerequisites

Bun runtimeValid API keys for OpenAI, Google, or DashScope

Limitations

  • Generation speed depends on third-party service load
  • Requires internet access
  • Consistency can vary between different model providers

How it compares

It unifies fragmented generation services into a single interface, removing the need to manually configure separate API endpoints.

Compared to similar skills

baoyu-image-gen side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
baoyu-image-gen (this skill)82moReviewBeginner
jimeng-mcp-skill194moCautionIntermediate
gemini-logo-remover98moReviewBeginner
ai-image99moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

baoyu-xhs-images

JimLiu

Generates Xiaohongshu (Little Red Book) infographic series with 10 visual styles and 8 layouts. Breaks content into 1-10 cartoon-style images optimized for XHS engagement. Use when user mentions "小红书图片", "XHS images", "RedNote infographics", "小红书种草", or wants social media infographics for Chinese platforms.

2051

baoyu-article-illustrator

JimLiu

Analyzes article structure, identifies positions requiring visual aids, generates illustrations with Type × Style two-dimension approach. Use when user asks to "illustrate article", "add images", "generate images for article", or "为文章配图".

1848

baoyu-comic

JimLiu

Knowledge comic creator supporting multiple art styles and tones. Creates original educational comics with detailed panel layouts and sequential image generation. Use when user asks to create "知识漫画", "教育漫画", "biography comic", "tutorial comic", or "Logicomix-style comic".

1329

baoyu-infographic

JimLiu

Generates professional infographics with 20 layout types and 17 visual styles. Analyzes content, recommends layout×style combinations, and generates publication-ready infographics. Use when user asks to create "infographic", "信息图", "visual summary", or "可视化".

1230

baoyu-compress-image

JimLiu

Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.

1129

baoyu-cover-image

JimLiu

Generates article cover images with 5 dimensions (type, palette, rendering, text, mood) combining 9 color palettes and 6 rendering styles. Supports cinematic (2.35:1), widescreen (16:9), and square (1:1) aspects. Use when user asks to "generate cover image", "create article cover", or "make cover".

1020

You might also like

jimeng-mcp-skill

wwwzhouhui

使用jimeng-mcp-server进行AI图像和视频生成。当用户请求从文本生成图像、合成多张图片、从文本描述创建视频或为静态图像添加动画时使用此技能。支持四大核心能力:文生图、图像合成、文生视频、图生视频。需要jimeng-mcp-server在本地运行或通过SSE/HTTP访问。

19158

gemini-logo-remover

bear2u

Remove Gemini logos, watermarks, or AI-generated image markers using OpenCV inpainting. Use this skill when the user asks to remove Gemini logo, AI watermark, or any logo/watermark from images.

9115

ai-image

tyrchen

Generate AI images using OpenAI's gpt-image-1 model with customizable aspect ratios and artistic themes. Use when the user wants to create images, generate artwork, or mentions image generation with specific styles like Ghibli, futuristic, Pixar, oil painting, or Chinese painting.

9101

baoyu-article-illustrator

JimLiu

Analyzes article structure, identifies positions requiring visual aids, generates illustrations with Type × Style two-dimension approach. Use when user asks to "illustrate article", "add images", "generate images for article", or "为文章配图".

1848

nano-banana-pro-prompts-recommend-skill

YouMind-OpenLab

Recommend suitable prompts from 6000+ Nano Banana Pro image generation prompts based on user needs. Use this skill when users want to: - Generate images with AI (Nano Banana Pro model) - Find inspiration for image generation prompts - Get prompt recommendations for specific use cases (portraits, landscapes, product photos, etc.) - Create illustrations for articles, videos, podcasts, or other content - Translate and understand prompt techniques

1335

image-generation

onyx-dot-app

Generate images using nano banana.

634

Search skills

Search the agent skills registry