Skip to content

Guide · Agent skill

How to use the OpenAI Image Generator agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The openai-image-gen skill lets an AI agent generate a batch of images through OpenAI's Images API, either from prompts it invents or from a prompt you supply. It saves the PNG files, a prompts.json file that maps each prompt to its image, and an index.html thumbnail gallery you can open in a browser. This guide explains what agent skills are, how to install this one, how to ask for it, and what it needs before it will run.

OpenAI Image Generatorsteipete/agent-scripts · MIT

Quick start

  1. 1Get an API key. Create or sign in to an OpenAI account with API access and generate a key.
  2. 2Set OPENAI_API_KEY. Export the key as the OPENAI_API_KEY environment variable in your shell.
  3. 3Download and unzip the skill. Download the ZIP from this page and unzip it so the openai-image-gen folder is present.
  4. 4Place the skill folder. Move it to ~/.claude/skills/ for all projects, or to .claude/skills/ inside one project.
  5. 5Ask for images. Describe the images you want in plain language, including how many, and let the agent load the skill.
  6. 6Open the gallery. Open index.html in your browser to browse the thumbnails and check prompts.json for the prompt behind each file.

What is an agent skill, and what does this one do?

An agent skill is a folder containing a SKILL.md instruction file and optional scripts that an AI agent can load when a task matches the skill's description. This one is named openai-image-gen and its description is "OpenAI Images API: batches, prompt sampler, gallery."

Once installed, the agent can generate a handful of random but structured prompts, or use a prompt you provide, and render them with OpenAI's image generation service. It runs a Python script called gen.py to do the work.

  • Invents structured, random prompts (for example, a lobster piloting a scooter) when you do not give one
  • Uses your own prompt when you pass one in
  • Saves *.png images, prompts.json (prompt to file mapping) and index.html (thumbnail gallery)

What you need before installing

The skill needs Python 3, an OpenAI account with API access, and an OPENAI_API_KEY environment variable holding your key. Every image request is billed to the owner of that key, so check your OpenAI account before running large batches.

OPENAI_BASE_URL or OPENAI_API_BASE is optional. Set either one only if you want requests sent to a different API endpoint.

  • Python 3
  • An OpenAI account with API access and an API key
  • OPENAI_API_KEY set in your environment
  • Optional: OPENAI_BASE_URL or OPENAI_API_BASE
export OPENAI_API_KEY=your-key-here

How to install the openai-image-gen skill

Download the skill ZIP from this page and unzip it. To make it available to Claude Code for 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.

In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your project folder
  • Claude apps: Settings → Capabilities → Skills, then upload

How to trigger the skill with a natural request

You do not need a special command. Describe what you want in plain language, and the agent will load the skill when your request matches its description. Ask for images, a batch of concepts, or a gallery of AI art, and say how many you want if it matters.

If you want a specific image rather than random prompts, include the subject and style in your request so the agent passes it to the script as a prompt.

  • "Make a batch of 16 concept images for a coffee brand and open the gallery."
  • "Generate 4 studio-style images of a lobster astronaut."
  • "Create a set of random structured image prompts and render them."

Run the script directly and use the main options

The agent normally runs the script for you, but you can also run it yourself. The default run writes output to ~/Projects/tmp/ when that folder exists, otherwise to ./tmp/. Open the gallery after a run to browse the results.

The flags below come from the skill's documentation. --count sets how many images to make, --model picks the model, --prompt supplies your own prompt, --size and --quality control the output, and --out-dir sets the output folder.

  • --count: number of images (example uses 16)
  • --model: model name (example uses gpt-image-1.5)
  • --prompt: your own prompt (example uses 4 images)
  • --size: output size (example uses 1536x1024)
  • --quality: output quality (example uses high)
  • --out-dir: where to save files (example uses ./out/images)
python3 ~/Projects/agent-scripts/skills/openai-image-gen/scripts/gen.py open ~/Projects/tmp/openai-image-gen-*/index.html python3 ~/Projects/agent-scripts/skills/openai-image-gen/scripts/gen.py --count 16 --model gpt-image-1.5 python3 ~/Projects/agent-scripts/skills/openai-image-gen/scripts/gen.py --prompt "ultra-detailed studio photo of a lobster astronaut" --count 4 python3 ~/Projects/agent-scripts/skills/openai-image-gen/scripts/gen.py --size 1536x1024 --quality high --out-dir ./out/images

Safety notes: scripts, network and your data

This skill runs a script and uses the network. Each prompt is sent to OpenAI, so do not use it for projects where prompts or content must stay on your machine. Review gen.py before running it if you need to confirm exactly what it does.

Outputs are AI-generated and not verified for rights or accuracy, so do not rely on them for work that needs licensed or guaranteed brand-safe imagery.

  • Runs scripts: yes (scripts/gen.py)
  • Uses network: yes (prompts and requests go to OpenAI)
  • Your API key is billed for each image generated

What people use it for

  • Quickly producing a batch of concept images to browse for a design direction
  • Exploring how OpenAI's image models respond to different prompts from a terminal
  • Building a gallery of varied AI art with each prompt saved next to its image

Frequently asked questions

Is the openai-image-gen skill free?

The skill is published under the MIT licence, but it calls OpenAI's Images API, which is billed to the owner of your OPENAI_API_KEY. Each generated image costs money through your OpenAI account, so the skill itself being free does not mean the images are.

What do I need to run the OpenAI image generator skill?

You need Python 3, an OpenAI account with API access, and an OPENAI_API_KEY environment variable containing your key. OPENAI_BASE_URL or OPENAI_API_BASE is optional and only needed if you use a different API endpoint.

Where do I install an agent skill like this one?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder for one project. In the Claude apps you can upload it under Settings → Capabilities → Skills.

Where are the generated images saved?

By default the script writes to ~/Projects/tmp/ when that folder exists, otherwise to ./tmp/. You can choose a folder with --out-dir. Each run produces PNG files, prompts.json and index.html.

Can I use my own prompt instead of random ones?

Yes. Pass a prompt with the --prompt flag and choose how many images to make with --count. Without --prompt, the skill generates structured random prompts itself.

Are the images safe to use commercially?

The source does not confirm rights or licensing for outputs, and the images are AI-generated and unverified for accuracy. Check the terms of OpenAI's service and review each image before using it in work that needs licensed or brand-safe imagery.

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 want fast batches of concept images, a browsable gallery, and a record of which prompt made which file, and you already have an OpenAI API key you are comfortable paying from. Pick something else if you need guaranteed licensed imagery, cannot send prompts to a third party, or do not want per-image costs.

Download the skill