A tiny skill that routes image generation through Codex CLI's $imagegen,
so your existing ChatGPT Plus/Pro quota does the work — no extra OpenAI API credits.
You already pay for ChatGPT. You already have Codex CLI installed. And Codex CLI happens to
ship with a built-in $imagegen tool. So why pay
again for OpenAI Images API credits when you want Claude Code to generate an image?
This skill bridges Claude Code and Codex CLI: Claude phrases the prompt, the skill shells out to
codex exec '$imagegen ...', and the PNG lands wherever you asked.
~40-70 seconds per image, zero marginal cost on top of your subscription.
These were generated by the same script in this repo, with a shared pastel-illustration style prompt appended to each per-image concept. It scaled cleanly to a 26-image batch.
If you don't need Claude Code in the loop, call $imagegen straight from Codex:
# interactive codex > $imagegen a tiny shiba inu wearing a red bow tie, watercolor, no text # non-interactive (one-shot) codex exec -C "$(pwd)" -s workspace-write --skip-git-repo-check \ '$imagegen a tiny shiba inu wearing a red bow tie, watercolor, no text'
Either way, the PNG lands at ~/.codex/generated_images/<session-id>/ig_*.png. This skill exists because the non-interactive form is awkward to script — you have to parse Codex's stdout for the session id, find the PNG, copy it out, and dodge Codex's sandbox eating your cp. The wrapper handles all of that.
Availability: $imagegen shipped as a built-in skill in
Codex CLI v0.117.0 on
2026-03-26; upgraded to gpt-image-2 in v0.123.0 on 2026-04-23.
Make sure your Codex is up to date with npm i -g @openai/codex.
Prerequisites: Codex CLI installed and codex login done.
# clone the repo straight into your Claude Code skills directory git clone https://github.com/yazelin/codex-imagegen-skill ~/.claude/skills/codex-imagegen chmod +x ~/.claude/skills/codex-imagegen/codex-imagegen.sh
Restart Claude Code and the codex-imagegen skill is available.
Inside Claude Code, just ask:
Generate a cute Shiba Inu with a red bow tie in watercolor style, save to /tmp/test-shiba.png
Or run the bundled script directly:
~/.claude/skills/codex-imagegen/codex-imagegen.sh \
"a tiny shiba inu with a red bow tie, watercolor, no text" \
/tmp/test-shiba.png
The trigger-and-usage doc Claude reads. Covers when to use, when not to use, and prompt craft tips.
Standalone wrapper. Runs codex exec '$imagegen ...', locates the output PNG, copies it to your target path.
Works on Linux, macOS, WSL. Sidesteps Codex's bubblewrap sandbox by doing the file copy in the host shell.
Personal/dev use only. Don't power production multi-user services with a personal subscription — that's against the spirit of the terms.