gpt-image-2

Generate and edit images via GPT Image 2 through the local Codex CLI.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill gpt-image-2-aadi-110i
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpt-image-2
Source: https://github.com/Aadi-110i/PEP-PROJECT/tree/main/skills/gpt-image-2
Command: npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill gpt-image-2-aadi-110i

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? It lets you generate and edit images with GPT Image 2 (ChatGPT Images 2.0) directly inside your agent workflow, reusing your existing ChatGPT Plus or Pro subscription through the local Codex CLI instead of paying for separate OpenAI API access or per-image billing. ## Core Features & Use Cases - Text-to-Image Generation: Run a single bash script with a prompt and output path to produce a PNG, JPEG, or WebP image decoded from the Codex session rollout. - Image-to-Image Editing & Style Transfer: Pass one or more reference images with repeatable --ref flags for editing, restyling, or multi-reference composition. - Use Case: Attach a flat-color icon and ask to repaint it as a 1950s ukiyo-e woodblock print; the script runs codex exec with the image_generation feature enabled and writes the result to your chosen output path. ## Quick Start Ask the agent to use GPT Image 2 to generate an image of your subject and save it to a specified output path.

Frequently Asked Questions about gpt-image-2

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate an image with GPT Image 2 in Claude Code?

Run the gen.sh script with a --prompt and an --out path. It calls codex exec with the image_generation feature enabled, then decodes the image from the new session rollout file and writes it to your output path.

How do I edit or restyle an existing image with GPT Image 2?

Pass one or more reference images using the repeatable --ref flag along with your prompt, for example asking to repaint a photo in watercolor. The script attaches each reference via codex exec -i flags for image-to-image composition.

Do I need an OpenAI API key to use GPT Image 2 this way?

No separate OpenAI API key is required. The skill reuses your local Codex CLI login, which must be tied to a ChatGPT Plus or Pro subscription that includes image generation entitlement.

Why does image generation fail with exit code 7?

Exit code 7 means no image payload was found in the new session rollout, usually because the imagegen tool did not run. Common causes are the image_generation feature not being enabled, quota exhaustion, or the capability being refused.

What are the limitations of generating images through the Codex CLI?

It depends on a working codex login and a ChatGPT plan with image generation, so it will not function without them. Calls are serialized by the filesystem snapshot diff, so concurrent invocations are not supported.