Skip to main content
skill CX Codex

openai-image-gen — Claude Code skill: OpenAI image generation

This skill generates images through the OpenAI Images API using GPT Image, DALL-E 3 or DALL-E 2. It also builds an HTML gallery of the results.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add swarmclawai/swarmclaw --skill openai-image-gen -a claude-code
Open on GitHub

What openai-image-gen does

The skill runs python3 {baseDir}/scripts/gen.py, which calls the OpenAI Images API. Model, size, quality, background and output format come from flags: --model, --size, --quality, --background, --output-format. DALL-E 3 adds --style with vivid or natural.

Batch work goes through --count — --count 16 with gpt-image-1, for instance. DALL-E 3 caps the count at 1 automatically, since that model only takes n=1. You can pass a prompt with --prompt or let the random prompt sampler pick one.

Output includes the image files, prompts.json mapping prompts to files, and index.html with a thumbnail gallery. You need OPENAI_API_KEY set in the environment and python3 on the machine. Generation outlasts normal timeouts, so raise the limit when running from a shell — the README suggests 300 seconds.

What it helps with

  • generate a batch of images from one description
  • produce a webp image with a transparent background
  • build a thumbnail gallery to review results fast
  • switch between GPT Image and DALL-E without editing code
  • keep a prompt-to-file map in JSON

Example prompts for the agent

  • Generate 16 images with gpt-image-1 and open the gallery
  • Make a 1536x1024 image at high quality into ./out/images
  • Generate a dall-e-3 image in vivid style from a mountain landscape prompt

How to install openai-image-gen

1Skills CLI (Vercel)

npx skills add swarmclawai/swarmclaw --skill openai-image-gen -a claude-code

2Manually: put the files in place

~/.claude/skills/openai-image-gen/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/openai-image-gen/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about openai-image-gen

How do I install Anthropic-image-gen in Claude Code?

Run npx skills add swarmclawai/swarmclaw --skill openai-image-gen -a claude-code. The skill lands at ~/.claude/skills/openai-image-gen/SKILL.md.

What does openai-image-gen do?

It generates images through the OpenAI Images API on GPT Image, DALL-E 3 and DALL-E 2. Batch mode, random prompts and an HTML gallery are included.

What does the skill need to run?

An OPENAI_API_KEY environment variable and python3. When you launch it from a shell, allow a longer timeout — generation takes a while.

Source text

SKILL.md · MIT
---
name: openai-image-gen
description: Generate images via OpenAI Images API (GPT Image, DALL-E 3, DALL-E 2). Supports batch generation with random prompt sampler and HTML gallery output. Use when asked to generate images with OpenAI and an OPENAI_API_KEY is available.
metadata:
  {
    "openclaw":
      {
        "emoji": "🎨",
        "requires": { "bins": ["python3"], "env": ["OPENAI_API_KEY"] },
        "primaryEnv": "OPENAI_API_KEY",
        "install":
          [
            {
              "id": "python-brew",
              "kind": "brew",
              "formula": "python",
              "bins": ["python3"],
              "label": "Install Python (brew)",
            },
          ],
      },
  }
---

# OpenAI Image Gen

Generate images via the OpenAI Images API with an HTML gallery viewer.

## Run

Note: Image generation can take longer than typical timeouts. Set a higher timeout when running via shell (e.g., 300 seconds).

```bash
python3 {baseDir}/scripts/gen.py
```

## Useful Flags

```bash
# GPT image models with various options
python3 {baseDir}/scripts/gen.py --count 16 --model gpt-image-1
python3 {baseDir}/scripts/gen.py --prompt "ultra-detailed studio photo of a lobster astronaut" --count 4
python3 {baseDir}/scripts/gen.py --size 1536x1024 --quality high --out-dir ./out/images
python3 {baseDir}/scripts/gen.py --model gpt-image-1.5 --background transparent --output-format webp

# DALL-E 3 (note: count is automatically limited to 1)
python3 {baseDir}/scripts/gen.py --model dall-e-3 --quality hd --size 1792x1024 --style vivid
python3 {baseDir}/scripts/gen.py --model dall-e-3 --style natural --prompt "serene mountain landscape"

# DALL-E 2
python3 {baseDir}/scripts/gen.py --model dall-e-2 --size 512x512 --count 4
```

## Model-Specific Parameters

### Size

- **GPT image models** (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`): `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto`. Default: `1024x1024`
- **dall-e-3**: `1024x1024`, `1792x1024`, or `1024x1792`. Default: `1024x1024`
- **dall-e-2**: `256x256`, `512x512`, or `1024x1024`. Default: `1024x1024`

### Quality

- **GPT image models**: `auto`, `high`, `medium`, or `low`. Default: `high`
- **dall-e-3**: `hd` or `standard`. Default: `standard`
- **dall-e-2**: `standard` only

### Other Parameters

- **GPT image models** support `--background` (`transparent`, `opaque`, `auto`) and `--output-format` (`png`, `jpeg`, `webp`)
- **dall-e-3** supports `--style` (`vivid` for hyper-real, `natural` for more natural looking)
- **dall-e-3** only supports `n=1`; the script automatically limits count to 1

## Output

- Image files (`*.png`, `*.jpeg`, or `*.webp` depending on model and format)
- `prompts.json` (prompt-to-file mapping)
- `index.html` (thumbnail gallery — open in browser to review)

© swarmclawai · MIT · swarmclawai/swarmclaw

Similar skills

All skills for AI and ML →

From the same set4

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor