Guide · Agent skill
How to use the Generate Image agent skill (generate-image)
Updated · written with AI from the project's own documentation and checked against our catalogue data
The generate-image skill gives an AI agent the ability to create new images from a text description and to edit or combine existing images using reference files. It sends requests to OpenRouter's Image API, which routes them to one of several image models, and saves the result to a file. This guide explains what the skill does, how to install it, how to set up an OpenRouter key, and how to ask for images in plain language.
Quick start
- 1Download and unzip. Download the generate-image ZIP from this page and unzip it into a folder named generate-image. Confirm it contains SKILL.md, scripts/generate_image.py and references/models.md.
- 2Place the folder. Move the folder into ~/.claude/skills/ for personal use or into a project's .claude/skills/ directory. Alternatively, upload it in the Claude apps under Settings, Capabilities, then Skills.
- 3Add your OpenRouter key. Create a key at openrouter.ai/keys and make it available as OPENROUTER_API_KEY, pass it with --api-key, or store it in a .env file.
- 4Ask for an image. Describe the subject, style, lighting, composition and what to avoid. The agent runs the script and saves the result to a file.
- 5Check the result. Have the agent read the file back and check composition, aspect ratio and any text before you use it.
What the generate-image skill makes the agent do
An agent skill is a folder of instructions and scripts that an agent can load when a task matches it. This one covers images: photos, illustrations, concept art, presentation and poster visuals, logos and vector marks, and editing or compositing from reference images.
The skill sends your request to OpenRouter, which passes it to a chosen model such as Gemini, Seedream, Recraft, GPT-Image or Riverflow. The returned picture is saved to a file, and the skill tells the agent to open and check it. The skill also lists available models and their options, and can preview a request without generating anything.
- Use it for: photos, illustrations, artwork, concept art, visual assets, logos, and editing from reference images.
- Do not use it for flowcharts, circuit diagrams, biological pathways or other technical schematics. The skill directs those to the separate scientific-schematics skill.
How to install the generate-image skill
Download the generate-image ZIP from this page and unzip it so the skill is a folder named generate-image containing SKILL.md, scripts/generate_image.py and references/models.md. Place that folder in one of two locations, depending on how you want to use it.
You can also upload the skill through the Claude apps. Open Settings, choose Capabilities, then Skills, and add the skill there.
- Personal install: put the folder in ~/.claude/skills/ so it is available across your projects.
- Project install: put the folder in the .claude/skills/ directory of one project.
- Claude apps: upload the skill under Settings, then Capabilities, then Skills.
Set up your OpenRouter API key
Generating images requires an OpenRouter key. Create one at https://openrouter.ai/keys. The script looks for the key in this order: the --api-key flag, the OPENROUTER_API_KEY environment variable, then an OPENROUTER_API_KEY line in a .env file. It searches the working directory upward, then the script's own directory.
Listing models, inspecting a model and running --dry-run do not need a key. If no key is found, the script exits with setup instructions.
- Keep the key out of shared files. The environment variable or a local .env file are the usual choices.
- Generation bills per request against your OpenRouter account.
Generate or edit an image from a prompt
Run the commands from the skill directory, because input and output paths resolve from the working directory. If you do not pass -o, the output defaults to generated_image with an extension matching the returned media type, or .bin when the type is unknown. The script does not convert formats; if you give an output suffix that does not match, it keeps your suffix and prints a warning.
After generating, read the file back and check it. Composition, aspect ratio and any text are the things models most often get wrong without warning.
- Pass -i or --input with a local path, an HTTP(S) URL or a data URL. The flag can be repeated to combine several references.
- Costs from OpenRouter and upstream providers are printed separately when they are supplied.
python scripts/generate_image.py "A beautiful sunset over mountains"
python scripts/generate_image.py "Make the sky purple" -i photo.jpg -o edited.pngChoose a model and check its options
The default model is google/gemini-3.1-flash-image. Use it for general quality and prompt adherence. Switch models when you need something specific: a vector output, a transparent background, several images per request, or a seed for repeatable results.
Model support differs for parameters such as --resolution, --output-format, --quality, --background, --aspect-ratio, --n and --seed. The script checks the model catalogue before generating and fails locally with the legal values if a combination is not allowed. Use the live listing to confirm current options.
- Vector or SVG output: recraft/recraft-v4.1-vector.
- Transparent background: openai/gpt-image-1 with --background transparent.
- Cheap drafts: google/gemini-3.1-flash-lite-image or openai/gpt-image-1-mini.
- Legible text inside the image: recraft/recraft-v4.1 or sourceful/riverflow-v2.5-pro, though the skill notes that text can still be unreliable.
- --n is an upper bound; providers may return fewer images. A seed is not a guarantee across model versions.
python scripts/generate_image.py --list-models
python scripts/generate_image.py --list-models gemini
python scripts/generate_image.py --model-info openai/gpt-image-1Write prompts that produce usable images
Prompt wording matters more than model choice. Describe five things in one sentence each: the subject and how much of it is in frame, the medium and style, the lighting and palette, the composition, and what to avoid.
To refine an image, feed the last output back as a reference with -i and describe only the change. To iterate cheaply, draft with a lower-cost model and switch to your final model once the wording works.
- Subject: A single pipette tip above a 96-well plate.
- Lighting and palette: soft diffuse lighting, cool blue and white palette.
- Composition: wide shot, subject left of centre, empty space on the right for a title.
- Avoid: no text, no labels, no watermark.
- For posters and slides, asking for empty space where a title will go is the most useful compositional instruction.
Safety notes: scripts and network access
This skill runs a Python script and sends data over the network to openrouter.ai. It requires Python 3.9 or newer and uses only the standard library. Your prompts and any reference images you pass in are sent to OpenRouter for processing.
Because the skill runs code and makes paid requests, read scripts/generate_image.py before first use, keep your key private, and use --dry-run to inspect a request before sending it. Note that --dry-run and --no-preflight together only show the request payload offline; they do not confirm that a provider accepts the options.
- Runs scripts: yes. Uses network: yes. Network access to openrouter.ai is required.
- The skill's allowed tools are Read, Write, Edit and Bash.
What people use it for
- Create concept art or a poster visual with empty space reserved for a title.
- Edit an existing photo with a text instruction, such as changing the sky or adding an object.
- Combine two reference images into a blended style image using several -i inputs.
- Produce a transparent-background image with openai/gpt-image-1 and --background transparent.
- Add image generation to an automated workflow by calling the script from your own code.
Frequently asked questions
Is the generate-image skill free to use?
The skill is published under the MIT licence. Image generation itself is billed per request against your OpenRouter key, so you need an OpenRouter account to generate images. Listing models, inspecting a model and --dry-run do not need a key.
What do I need to run the generate-image skill?
You need Python 3.9 or newer, network access to openrouter.ai, and an OpenRouter API key set as OPENROUTER_API_KEY, passed with --api-key, or stored in a .env file. The script uses only the standard library.
Where do I install the generate-image skill?
Put the unzipped generate-image folder in ~/.claude/skills/ for personal use or in a project's .claude/skills/ directory. You can also upload it in the Claude apps under Settings, Capabilities, then Skills.
Can I use this skill for flowcharts or circuit diagrams?
No. The skill directs flowcharts, circuit diagrams, biological pathways and other technical schematics to the separate scientific-schematics skill, which is better suited to those tasks.
Why did my image request fail with a parameter error?
Each model accepts a different set of options and values. The script checks the model catalogue and rejects unsupported options before billing, listing the allowed values. Run --model-info on the model you chose and adjust the flag, for example --background or --quality.
Will I get the same image again if I reuse a seed?
Not reliably. A seed is only available on some models and is not a guarantee across versions. Keep the model, prompt and parameters fixed to get the closest repeat, but do not depend on exact reproduction.
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
Use this skill if you want an agent to generate or edit images from text and reference files, and you are comfortable paying per request through OpenRouter. Pick a different tool if you need technical diagrams, which belong to the scientific-schematics skill, or if you need exact text, precise parameters or identical reproductions every time.
Download the skill