Installing and Using the gpt-image-2 Skill
Reuse your ChatGPT Plus / Pro subscription to generate and edit images directly inside OpenClaw — no separate OpenAI API key, no per-image billing.
What This Skill Solves
If you already pay for ChatGPT Plus or Pro and don't want to spin up a separate OpenAI API key — or get billed per image on top of that subscription — gpt-image-2 is the skill for you.
It pulls ChatGPT Images 2.0 (the same image-generation capability you get on chatgpt.com) directly into OpenClaw. The trick: it reuses the locally-logged-in codex CLI session, lets the agent fire imagegen over that already-authenticated channel, and decodes the resulting image out of the session rollout onto disk.
What it supports:
- Text-to-image — pure prompt → image
- Image-to-image / edit — supply a reference image, repaint, restyle, restructure
- Multi-reference composition —
--refis repeatable, you can feed multiple references at once - Style transfer — render the content of A in the style of B
The skill comes from agentspace-so/agent-skills, MIT-licensed, and is one of several community-maintained open-source skills.
Note: this skill does not grant you image-generation capability on its own. It exposes the capability you already have through your ChatGPT subscription. No subscription → installing the skill alone won't get you any images.
Prerequisites
All of the following must be satisfied. Each one is paired with a one-liner check command and the real output from my own machine.
1. ChatGPT Plus or Pro subscription
The kind that includes Image 2 / image-generation entitlement. Plus and Pro both work; the free tier does not. There's no command that verifies this directly — check your account status on chatgpt.com.
2. Codex CLI installed and logged in
First check whether you already have it:
codex --version
codex-cli 0.123.0
If you get command not found, install globally via npm:
npm install -g @openai/codex
Source or platform binaries are available on the Releases page of openai/codex.
After install, log in:
codex login
This walks you through browser auth. The ChatGPT account you log in with must be the same one that has your Plus/Pro subscription.
3. python3 on PATH
The skill ships an extract_image.py helper that decodes the base64 image payload out of the session rollout:
python3 --version
Python 3.12.3
macOS ships with this. On Linux without it: apt install python3.
Installing the Skill
The community-maintained skills.sh registry exposes an npx skills CLI that pulls skills straight from its index. The outputs below are illustrative — I didn't re-run them on this machine since the skill is already installed; the actual format you see may differ slightly.
1. Search to confirm it exists
npx skills search gpt-image-2
✔ Searched skills.sh registry
NAME VERSION AUTHOR DESCRIPTION
───────────── ─────── ──────────── ──────────────────────────────────────────────
gpt-image-2 1.2.0 agentspace Image generation via your ChatGPT Plus/Pro
subscription (text-to-image, i2i, multi-ref).
1 result.
2. Install to the OpenClaw shared skills directory
npx skills add agentspace-so/agent-skills -s gpt-image-2 -a openclaw -y
✔ Resolved gpt-image-2@1.2.0 from agentspace-so/agent-skills
✔ Cloning skill files...
↳ writing SKILL.md
↳ writing scripts/gen.sh
↳ writing scripts/extract_image.py
↳ writing gallery/d-ukiyoe.png
✔ Installed to ~/.openclaw/skills/gpt-image-2/
Done. Trigger with: "use gpt-image-2 to ..."
3. Install for a specific agent (optional)
If you maintain multiple agent configs and don't want a shared install, scope it:
npx skills add gpt-image-2 --agent ahzua
✔ Installed to ~/.openclaw/.agents/ahzua/skills/gpt-image-2/
Install path reference
With -a openclaw, the skill lands in the workspace-shared directory ~/.openclaw/skills/gpt-image-2/ — every agent in the workspace can use it. The verification commands below assume this path.
Already installed it the default way? Reinstall it:
npx skills remove -s gpt-image-2 -y npx skills add agentspace-so/agent-skills -s gpt-image-2 -a openclaw -yRun
ls -la ~/.openclaw/skills/gpt-image-2afterward — adrwx...real directory is correct. If it starts withlrwx...(symlink), the flag didn't take; try again.
Verifying the Install
1. Check the directory layout
ls ~/.openclaw/skills/gpt-image-2/
SKILL.md gallery scripts
All three present means you're good. SKILL.md is the trigger spec. scripts/ holds gen.sh and extract_image.py. gallery/ contains the example image referenced by the README.
2. Sanity-check the SKILL.md frontmatter
cat ~/.openclaw/skills/gpt-image-2/SKILL.md | head -20
---
name: gpt-image-2
displayName: "🪞 GPT Image 2 — Image Generation via Your ChatGPT Subscription"
description: >
Generate images with GPT Image 2 (ChatGPT Images 2.0) using your existing
ChatGPT Plus or Pro subscription — no separate OpenAI access, no per-image
billing. Supports text-to-image, image-to-image editing, style transfer,
and multi-reference composition via the local Codex CLI. Triggers on
"gpt image 2", "gpt-image-2", "ChatGPT Images 2.0", "image 2", or any
explicit ask to generate or edit an image through the user's ChatGPT plan.
emoji: "🪞"
homepage: https://agentspace.so
license: MIT
---
# 🪞 GPT Image 2 — Image Generation via Your ChatGPT Subscription
[agentspace.so](https://agentspace.so/?utm_source=skills.sh&utm_medium=skill&utm_campaign=gpt-image-2) · [GitHub](https://github.com/agentspace-so/agent-skills/tree/main/gpt-image-2)
If you see that frontmatter block, the skill files themselves are intact.
3. Inspect gen.sh's usage banner
bash ~/.openclaw/skills/gpt-image-2/scripts/gen.sh --help
# Generate an image via Codex CLI's imagegen tool, reusing the user's
# ChatGPT subscription session. Supports text-to-image and image-to-image.
#
# Implementation note: on codex-cli 0.111.0 the `imagegen` tool does NOT
# write a PNG file to disk. The generated image is embedded as base64 inside
# the session rollout jsonl under ~/.codex/sessions/YYYY/MM/DD/. This script
# captures the new session file created by the run and decodes the image
# out of it. Flags: `--enable image_generation` turns the under-development
# tool on; `--ephemeral` is intentionally NOT passed so the session is
# persisted and we can read it back.
#
# Usage:
# gen.sh --prompt "<text>" --out <path.png> [--ref <image>]... [--timeout-sec N]
#
# Exit codes:
# 0 success (path printed on stdout)
# 2 bad args
# 3 required CLI missing (codex / python3)
# 4 reference image not found
# 5 codex exec failed
# 6 no new session file detected
# 7 image payload not found in session file (imagegen likely did not run)
--help exits 0 without ever calling codex, so it's safe to run — it won't burn any of your ChatGPT quota.
How to Trigger the Skill
This is the most important section, because the skill does not auto-fire on a generic "draw me an image" request. You have to name the GPT Image 2 route in your prompt.
Trigger phrases (verbatim from SKILL.md)
Per the SKILL.md description, any of the following phrasings will trigger it:
Triggers on "gpt image 2", "gpt-image-2", "ChatGPT Images 2.0", "image 2", or any explicit ask to generate or edit an image through the user's ChatGPT plan.
So if your prompt contains gpt image 2, gpt-image-2, ChatGPT Images 2.0, or image 2 — or you explicitly say "use my ChatGPT subscription to generate this image" — you'll hit the skill.
Concrete prompt examples
All four of these reliably trigger it — copy and edit the subject:
use gpt-image-2 to draw me a cyberpunk crab
image 2 this: repaint this reference as a watercolor
use ChatGPT Images 2.0 to generate a 1950s ukiyo-e lobster
call gpt image 2 and convert this attachment to pixel art
What does not trigger it
SKILL.md is explicit:
Do not auto-trigger for a plain "generate an image" request if the user didn't specify this route.
A bare "draw me an image", "generate a hero banner", or "make me a logo" will not route through this skill — the agent will fall back to whatever its default image strategy is (HTML mockups, a different model, a screenshot workflow, etc.). To go through GPT Image 2, you must name one of the trigger phrases above.
The flip side: once you've named GPT Image 2, the agent won't quietly substitute DALL·E, Midjourney, or an HTML mockup — SKILL.md's hard constraints forbid it. Naming the route locks it in.