Claude Code skill · MIT

generate images from Claude Code
on your ChatGPT subscription

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.

1Why this exists

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.

2What it can produce

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.

3Just want raw Codex (no skill)?

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.

4Install

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.

5Verify

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

6What's in the box

SKILL.md

The trigger-and-usage doc Claude reads. Covers when to use, when not to use, and prompt craft tips.

codex-imagegen.sh

Standalone wrapper. Runs codex exec '$imagegen ...', locates the output PNG, copies it to your target path.

Portable

Works on Linux, macOS, WSL. Sidesteps Codex's bubblewrap sandbox by doing the file copy in the host shell.

Honest about limits

Personal/dev use only. Don't power production multi-user services with a personal subscription — that's against the spirit of the terms.