Asset Goes Here Docs Sign in
ContentsMaking images with OpenAI
Make and deliver

Making images with OpenAI

agh openai is a ready-made fulfiller for image requests. It claims a request, sends its brief to OpenAI's image API, and delivers the result with provenance ai and made by OpenAI <model>. It runs only while you run it, and each image is billed to your OpenAI API key.

What you need

Keep the key in an environment variable or a secret store, never in a command you type or a file you commit:

export OPENAI_API_KEY=...   # paste it from your password manager

Try it

See what a run would take, and the exact prompts, without claiming anything or spending:

agh openai --dry-run --count 5

Then make one image and look at it under Review on the web page before you make more:

agh openai --count 1

When you're happy with the results, fill a batch:

agh openai --count 20 --tag role=card_art

Options

OptionWhat it does
--count NFill up to N requests, one at a time. The default is 1.
--tag key=value, --prefix id.Only take matching requests, the same as agh next.
--qualitylow, medium, high or auto (the default). Lower is cheaper and faster, which suits drafts.
--modelThe image model. The default is gpt-image-2, or OPENAI_IMAGE_MODEL if set.
--sizeOne size for every image, such as 1024x1024.
--dry-runShow the requests and prompts; claim and spend nothing.

How requests become images

When something goes wrong

The run stops at the first failure and says which request it had claimed. That claim expires on its own after two hours, and the request goes back to the queue. A refused key, an empty account or a rate limit all stop the run this way, so a mistake costs at most one image.

A rejected image goes back to the queue with its review note, and the next run puts that note in the prompt.

In Codex or a script

agh openai works anywhere the CLI does. In a Codex cloud environment, add OPENAI_API_KEY as a secret alongside the agh sign-in (see agh guide codex), allow api.openai.com in the network settings, and ask Codex to run agh openai --count 10.

For agents: this page as Markdown is at /docs/openai.md, and the CLI prints it with agh guide openai.