Guide · Agent skill
How to use the AI Image Generation agent skill (baoyu-image-gen)
Updated · written with AI from the project's own documentation and checked against our catalogue data
baoyu-image-gen is an agent skill that lets an AI agent create images from written descriptions by calling providers such as OpenAI, Google, OpenRouter, DashScope, Replicate and others. This guide explains what the skill does, how to install it, how to ask for images in plain language, and what it needs before it will run. By the end you will be able to install the skill, complete its one-time setup, and generate a single image or a batch of them.
Quick start
- 1Install the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/, or into .claude/skills/ inside a project, or upload it under Settings → Capabilities → Skills in the Claude apps.
- 2Install bun. Make sure bun is available, or npx to run it. If neither is present, the source suggests brew install oven-sh/bun/bun.
- 3Add a provider key. Set an API key for at least one provider such as OpenAI, Google or OpenRouter, or log in to the Codex CLI with codex on your PATH.
- 4Complete first-time setup. When you first ask for an image, answer the agent's questions about provider, model, quality and save location so EXTEND.md is created.
- 5Ask for an image. Describe the picture, the aspect ratio and the output file name in a normal request.
- 6Add references if needed. Attach a small set of reference photos and state that they show the same subject.
- 7Run a batch. Put prompts in files, build batch.json and run it with --jobs to render several images.
What the skill lets the agent do
Once installed, the skill gives your agent the ability to generate images. It supports text-to-image generation, reference images, aspect ratios and batch generation from saved prompt files. Its description also covers Azure OpenAI, Jimeng, Seedream, Z.AI GLM-Image, MiniMax and Agnes as providers.
The skill is built for images that come from written prompts. Users can point it at reference photos to keep a person or object consistent across images. It is not meant for editing your existing files in place; it creates new images at the path you give it.
- Text-to-image generation from a description
- Reference images to keep a subject consistent
- Aspect ratio and size control
- Batch generation from saved prompt files
Install the baoyu-image-gen skill
Download the ZIP for this skill from this page and unzip it. To make it available to all your projects, place the unzipped folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder.
If you use the Claude apps instead, open Settings, go to Capabilities, then Skills, and upload the skill there.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project folder
- Claude apps: Settings → Capabilities → Skills, then upload
Check the requirements
The skill runs scripts and uses the network, so it needs a few things in place first. You need bun, or npx (which can run bun), or tsx for the build helper. The source suggests installing bun with brew install oven-sh/bun/bun if none of these are available.
You also need at least one provider API key, such as OpenAI, Google, OpenRouter, DashScope, Replicate, MiniMax, Z.AI or Agnes. Alternatively, you can use a logged-in Codex CLI with the codex command on your PATH. The skill cannot run without one of these, and it needs network access to the provider you choose.
- bun (or npx to run bun, or tsx for the build helper)
- At least one provider API key, or a logged-in Codex CLI with codex on PATH
- Network access to the chosen provider's API
brew install oven-sh/bun/bunComplete first-time setup
Before any image is generated, the skill checks for a preferences file named EXTEND.md. It looks in your project's .baoyu-skills/baoyu-image-gen/ folder first, then in ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-image-gen/, then in $HOME/.baoyu-skills/baoyu-image-gen/. The first file it finds is used.
If no file exists, the agent asks you to choose a provider, model, quality and save location, then writes EXTEND.md. If the file exists but has no default model for the chosen provider, the agent asks only for the model. Saved preferences cover default provider, quality, aspect ratio, image size, default models and batch limits.
- Project: .baoyu-skills/baoyu-image-gen/EXTEND.md
- XDG: ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-image-gen/EXTEND.md
- User home: $HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md
Trigger the skill with natural requests
You do not need to type commands. The skill is designed to activate when you ask the agent to generate, create or draw images. Describe the picture you want, mention the provider or model if you have a preference, and say where you want the result saved.
If you want a person or object preserved from reference photos, say that explicitly. The skill's guidance is to keep prompts short and tell the model that the references are the same subject, rather than writing long generic facial descriptions, which can produce a new-looking person.
- "Draw a watercolor illustration of a lighthouse at dusk for my article and save it as lighthouse.png"
- "Generate a 16:9 image of a mountain lake using OpenRouter."
- "Using these two photos as references, make the same dog look like it is on a beach."
Run the commands yourself (optional)
The agent normally runs these for you, but you can call the main script directly. Replace the placeholder paths and prompts with your own. The source examples show a single image, a reference-based edit, a specific provider, and a batch run.
Quality accepts normal or 2k, and the default is 2k. Aspect ratio uses values such as 16:9, 1:1 or 4:3.
- --prompt sets the text, --image sets the output path
- --ref passes reference images
- --provider and --model pick the service and model
- --batchfile with --jobs runs many images
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --ar 16:9 --quality 2k
${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --ref source.png
${BUN_X} {baseDir}/scripts/main.ts --batchfile batch.json --jobs 4Generate a batch from prompt files
If you already have several prompts, you can put them in files and render them together. The skill includes a helper that builds a batch file from an outline and a prompts folder. The source describes this as a common pattern with baoyu-article-illustrator output.
By default the skill runs sequentially. Use batch parallel generation when you already have several prompts or want stable multi-image throughput. The --jobs option sets the worker count; its default is automatic, capped by your config with a built-in default of 10.
- Write one prompt per file, or reuse existing prompt files
- Build batch.json with the helper script
- Run the batch with a worker count that suits your provider
${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 4Safety, costs and privacy notes
This skill runs local scripts and sends prompts and any reference images to the provider you select, so it uses the network. Image generation through these providers requires paid access; the skill cannot run without a provider key or a logged-in Codex CLI. Check your provider's pricing before large batches.
Do not use the skill to create images of real people without their consent. The skill is built to preserve the identity of a referenced person, so treat reference photos of others with care.
- Runs scripts and uses network access
- Requires provider credentials, which are billed by the provider
- Use reference photos of real people only with consent
What people use it for
- Illustrations for articles or social posts generated from written prompts
- Iterating on a design with reference pictures to keep a subject consistent
- Rendering a set of existing prompt files in one batch run
- Generating images at specific aspect ratios such as 16:9 or 1:1
Frequently asked questions
How do I install the baoyu-image-gen skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder. In the Claude apps, you can instead upload it under Settings → Capabilities → Skills.
What do I need to run baoyu-image-gen?
You need bun, or npx to run bun, or tsx for the build helper. You also need at least one provider API key, or a logged-in Codex CLI with codex on your PATH, plus network access to that provider.
Is baoyu-image-gen free?
The skill is published under the MIT licence. Image generation itself is provided by paid services, so you need access to a provider, which is billed separately by that provider.
Why does it say OPENAI_API_KEY is required?
The openai provider uses the public OpenAI Images API and needs OPENAI_API_KEY. A ChatGPT or Codex desktop login does not grant that access, so either add an API key or use the codex-cli provider with a logged-in Codex CLI.
Can it use reference photos to keep a person consistent?
Yes. Reference images are supported by several providers, and the skill recommends a small set of references with prompts that say they show the same subject. It is designed to preserve a referenced person's identity, so only use photos of people who have agreed to it.
How does it compare to other image generators?
The source does not compare it to other tools, so this guide cannot say which is better. Its distinguishing features are support for many providers through one skill and batch generation from prompt files.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Choose this skill if you already work with an agent, have an API key for one of the supported providers, and want images generated from written prompts, including batches. Skip it if you have no provider access or no Codex subscription, or if you need to create images of real people without their consent.
Download the skill