codex-imagegen
Installation
SKILL.md
codex-imagegen
Generate and edit bitmap images from Claude Code by driving Codex's built-in image_gen tool through a one-shot codex exec run.
Why this works (the mechanism)
Codex ships a $imagegen skill with two modes:
- Built-in
image_gentool (this skill uses it) — runs against Codex's own backend using the user's ChatGPT/Codex login (~/.codex/auth.json). NoOPENAI_API_KEYrequired, no per-image API billing. It's the default Codex mode. - CLI fallback (
scripts/image_gen.py) — hits the OpenAI Image API directly, needsOPENAI_API_KEY. This skill does not use it.
The built-in tool is internal to Codex's agent runtime — there is no codex image subcommand. But a headless codex exec "<prompt>" run can invoke it. The wrapper script builds a tightly-scoped prompt that forces Codex to use only the built-in tool, runs codex exec, then locates the PNG Codex just wrote under $CODEX_HOME/generated_images/ and copies it into the working directory with a clean filename.
Source it wraps: ~/.codex/skills/.system/imagegen/ (Codex's installed skill).
Prerequisites
codexCLI on PATH and logged in (codex login). Verify:codex login statusor just run a generation — the wrapper reports a clear error if Codex isn't authed.- No API key needed. The wrapper explicitly tells Codex not to use the API/CLI fallback.