Generate images with the OpenAI Codex CLI without an
OPENAI_API_KEY— plus second-opinion code review and implementation, all from inside Claude Code.
↑ Generated by codex exec in 12 seconds. No OPENAI_API_KEY. Just codex login with ChatGPT.
codex CLI ships with a built-in image generation tool (image_gen.imagegen) that nobody talks about.
It's gated behind a feature flag that is already on by default (codex features list | grep image_generation). It uses your ChatGPT subscription auth — no separate OpenAI API key, no separate billing.
The catch: in codex exec mode, the model only picks this tool if you don't tell it to "use the OpenAI API" or "use curl/python". Most users never discover it.
This skill teaches Claude Code the right prompt shape to unlock it — plus wires up two more modes for the things codex is actually built for: review and impl.
The skill exposes one slash command, /codex-cli, with a subcommand as the first argument:
| Invocation | What it does | Example |
|---|---|---|
/codex-cli review |
Hands the diff to Codex for a second-opinion review | /codex-cli review --base main |
/codex-cli impl <prompt> |
Hands a coding task to Codex non-interactively | /codex-cli impl "add JWT refresh to api/auth.ts" |
/codex-cli image <prompt> |
Generates an image via Codex's built-in tool — no API key | /codex-cli image "isometric CPU diagram, neon" |
You can also just describe what you want in natural language ("ask codex to review my diff", "have codex generate an isometric CPU diagram"). The skill's when_to_use field tells Claude to load it on those phrasings.
iwr -useb https://raw.githubusercontent.com/cskwork/claude-codex-skill/main/install.ps1 | iexcurl -fsSL https://raw.githubusercontent.com/cskwork/claude-codex-skill/main/install.sh | bashDrop SKILL.md into your Claude Code skills directory:
| OS | Path |
|---|---|
| Windows | %USERPROFILE%\.claude\skills\codex-cli\SKILL.md |
| macOS / Linux | ~/.claude/skills/codex-cli/SKILL.md |
Restart Claude Code. The skill auto-registers — type /codex-cli to confirm.
- Claude Code installed
- Codex CLI ≥ 0.128.0 (
codex --version) codex login statusshows "Logged in" (ChatGPT login is enough; API key login also works)
/codex-cli review
Claude takes Codex's findings, regroups them by CRITICAL / HIGH / MEDIUM / LOW, and writes them back as a structured review with file:line citations — instead of dumping raw output. If Codex contradicts something Claude already verified, it flags the conflict instead of silently siding with Codex.
/codex-cli impl "add a /healthz endpoint to api/server.ts that returns 200 if redis is reachable"
Runs codex exec -s workspace-write -C <repo>, sandboxed to your workspace. Network access on, writes outside the repo blocked.
/codex-cli image "isometric data center, glowing fiber, dark background, 1024x1024"
→ Claude tells Codex to generate it (without naming an API).
→ Codex picks image_gen.imagegen automatically.
→ PNG lands at ~/.codex/generated_images/<session>/ig_*.png.
→ Claude copies it to your workspace and prints the absolute path.
Three pain points it removes:
- The image-generation discovery problem. Codex CLI's image tool works through ChatGPT login alone, but the docs barely mention it. Most people end up trying to set
OPENAI_API_KEYand giving up. This skill encodes the right invocation. - The Windows sandbox copy bug. On Windows,
codex-cli 0.128.0generates the image fine but fails to copy it into your workspace (CreateProcessAsUserW failed: 5). Most users see the failure message and assume nothing was generated. The skill knows to look in~/.codex/generated_images/and copy the file itself. - Sandbox safety. The skill never escalates to
-s danger-full-accessor--dangerously-bypass-approvals-and-sandboxwithout explicit per-run approval. You get Codex's power without bypassing its guardrails.
┌─────────────────┐ /codex-cli image "..." ┌──────────────────┐
│ Claude Code │ ────────────────────────▶ │ Skill (this) │
└─────────────────┘ └────────┬─────────┘
│
▼
codex exec -s workspace-write -C <out>
"Generate an image of ..."
│
▼
┌──────────────────────────────────────┐
│ Codex CLI agent (gpt-5.5) │
│ picks built-in image_gen.imagegen │
│ → uses ChatGPT auth from auth.json │
└──────────────────────────────────────┘
│
▼
~/.codex/generated_images/<session>/
ig_<hash>.png
│
▼
Claude copies → workspace/output.png
This skill ships with a reproducible test suite. The last verified run is committed at tests/RESULTS.md, so you can see exactly what was checked, when, and on which platform without running anything.
# Run the full suite (requires `codex login` with ChatGPT)
python tests/run.py
# Skip the E2E image-gen step (still validates metadata, URLs, codex install)
python tests/run.py --skip-imageThe suite covers metadata correctness (frontmatter spec compliance, no fictitious slash aliases), URL availability (install one-liners actually resolve), codex prerequisites (installed + logged in), and an end-to-end image generation that proves the no-API-key path works through the documented Windows copy-workaround. See tests/README.md for the full list of checks and how to add new ones.
| Codex CLI | Image gen | Code review | Code impl | Notes |
|---|---|---|---|---|
| 0.128.x (Windows) | ✅ via skill workaround | ✅ | ✅ | Sandbox copy bug — skill handles it |
| 0.128.x (macOS / Linux) | ✅ | ✅ | ✅ | Should work without the copy workaround |
| < 0.128 | ❓ untested | ✅ | ✅ | image_generation feature flag may differ |
PRs welcome. The skill is one Markdown file (SKILL.md) + frontmatter — no build step, no JS, no dependencies. Test by editing locally and restarting Claude Code.
MIT — see LICENSE.
Built and verified using Claude Code itself. The first generated image (the red panda above) was the moment we confirmed the image_gen.imagegen tool works through ChatGPT auth alone — no API key required.
