A Claude Code skill that generates and edits images with GPT Image, billed to your ChatGPT subscription. No
OPENAI_API_KEYrequired.
This skill generates images through the same Images endpoints Codex's built-in image tool uses, billed to your ChatGPT subscription, from a single command in your agent session.
/codex-image "a yellow taxi at night in rain"
→ saves a PNG to ./generated_images/ in about 10 to 30 s. The backend picks the size from the prompt.
v0.3.0 (2026-11-06). Requests now go to the Images endpoints (images/generations, images/edits) as Codex itself sends them, replacing the Codex Responses transport that ChatGPT and CLIProxyAPI began rejecting in November 2026. 177 tests passing; generation, edits and native transparency were confirmed live on chatgpt.com, a local relay and a CLIProxyAPI proxy.
See CHANGELOG.md for what's in this release, SKILL.md for the contract Claude reads, and references/ for the canonical request recipe and prompting cookbook.
The quickest path is the skills.sh CLI, which installs the skill into Claude Code, Codex CLI, Cursor, opencode, and 70+ other agents:
npx skills add nuko-nova-dynamics/codex-image # project install
npx skills add nuko-nova-dynamics/codex-image -g # global (all projects)Manual install (Claude Code):
git clone https://github.com/nuko-nova-dynamics/codex-image
ln -s "$(pwd)/codex-image" ~/.claude/skills/codex-imageEither way, the skill auto-detects Codex CLI's auth at ~/.codex/auth.json. Make sure you're signed in:
codex loginOptional: --format jpeg, --format webp and --transparent-mode chroma need Pillow (python3 -m pip install 'Pillow>=10'); everything else, including plain --transparent, is stdlib-only.
# Generate
/codex-image "a coffee mug"
# Transparent background (native alpha from the model)
/codex-image "a coffee mug" --transparent
# Edit a reference image
/codex-image "make it blue" --input ./mug.png
# Multi-turn (the agent passes --from-last to reuse the prior generation)
/codex-image "now add steam rising"
# Different size + format
/codex-image "hero banner" --size 2048x1152 --format webpFull flag reference: scripts/generate.sh --help.
Defaults can be overridden via env vars:
export CODEX_IMAGE_OUT_DIR="./assets/"
export CODEX_IMAGE_FORMAT="webp"Recognized env vars: CODEX_IMAGE_SIZE, CODEX_IMAGE_QUALITY, CODEX_IMAGE_FORMAT, CODEX_IMAGE_OUT_DIR, CODEX_IMAGE_MODEL (maps to --image-model), and CODEX_IMAGE_HOME (state dir, default ~/.codex-image). CODEX_IMAGE_ORCHESTRATOR is no longer read. Each flag-backed variable maps to the flag of the same name in scripts/generate.py.
This skill sends its requests wherever Codex's own config sends Codex. It reads $CODEX_HOME/config.toml over /etc/codex/config.toml: a custom model_provider gets the request at its base_url with its key (no ChatGPT sign-in needed, so a proxy works); otherwise the request goes to openai_base_url when set, else chatgpt.com/backend-api/codex/images/generations (or /images/edits), authenticated by the auth file Codex maintains. Reading the config needs Python 3.11 or later; on 3.10 the skill stops if a Codex config file exists. A config file that exists but cannot be parsed also stops the run instead of falling back to chatgpt.com. That route is not a public, versioned API: a Codex update that changes token storage, required headers, or version gating can break the skill until it's patched. Treat it as tested-against-current-Codex rather than contractually stable; the durable fallback is the official OpenAI Images API with an OPENAI_API_KEY.
On ChatGPT the backend chooses size, quality and image model from the prompt. --size, --quality and --image-model are sent but were not applied in checks on 2026-11-06; the script warns when the result differs and records the resolved values in the sidecar. Put the aspect ratio in the prompt ("square 1:1", "tall vertical 9:16"). On a proxy route the script sends the newest gpt-image-* model the proxy lists, because the proxy routes on it. See references/api-recipe.md.
- Size, quality and model are the backend's choice: inspect
resolved_sizeandresolved_qualityin the sidecar. The response does not name the image model. - Transparency needs the prompt sentence.
--transparentsendsbackground: "transparent"and appends one sentence to the prompt; the parameter alone returns almost no fully transparent pixels. Verified on opaque subjects; hair, glass, smoke and translucency are untested, so the chroma path survives as--transparent-mode chroma. See ADR-0002. - No batch: the backend ignores
nand returns one image. Multiple images = multiple invocations. - PNG only from the backend:
--format jpegand--format webpare converted locally and need Pillow. - No multi-turn via
previous_response_id: backend is stateless. Multi-turn is achieved by the agent re-passing the prior image (--from-last/--input, up to 16 references). - No token refresh: the skill reads Codex CLI's
auth.jsonas-is and never refreshes it. If the access token has expired, run any Codex command (orcodex login) to rotate it, then retry.
See tests/ for the full test suite and tests/smoke.sh for end-to-end coverage.
references/api-recipe.md— Images endpoint requests per route, and which fields the backend honorsreferences/prompting-cookbook.md— prompting fundamentals + templatesreferences/transparent-image-tips.md— how native transparency works, when it struggles, and the chroma fallbackCONTEXT.md— glossary; defines the transports that reach OpenAI image modelsdocs/adr/— architecture decisions
npx skills add nuko-nova-dynamics/codex-image handles placement for Codex CLI, Cursor, opencode, and the rest of the skills.sh-supported agents — no manual symlinking needed. The primary tested target is Claude Code; behavior in other agents is community-verified, and cross-CLI fixes are welcome via PR.
# Lint shell scripts
shellcheck scripts/*.sh
# Lint python
ruff check scripts/
# Unit tests (offline, mocked HTTP)
python3 -m pytest tests/ -q
# End-to-end smoke test (real backend, ~6 generations, needs codex login + Pillow)
./tests/smoke.shSee CONTRIBUTING.md.
MIT © 2026 Nuko Nova Dynamics
Bundles remove_chroma_key.py from openai/codex (Apache 2.0, compatible).