codex-imagegen

Generate and edit raster images using the Codex ImageGen host route or the GPT Image API.

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/zlsbksdxl/codex-imagegen --skill codex-imagegen-zlsbksdxl
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: codex-imagegen
Source: https://github.com/zlsbksdxl/codex-imagegen/tree/main/plugins/codex-imagegen/skills/codex-imagegen
Command: npx skills add https://github.com/zlsbksdxl/codex-imagegen --skill codex-imagegen-zlsbksdxl

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Producing or editing bitmap images inside a Codex workflow requires choosing between the built-in ImageGen host capability and a separately billed API fallback, with correct handling of prompts, reference images, credentials, and output paths. ## Core Features & Use Cases - Host-first generation: Invokes the Codex $imagegen route with gpt-image-2 for new images and reference-based edits when the runtime exposes it. - API fallback script: Runs generate_image.py against the OpenAI Image API for generation or edits, reading the active provider key and base URL from ~/.codex/config.toml without printing or persisting credentials. - Use Case: Attach a warehouse photo and ask for an edited planning visualization that preserves room geometry and camera perspective while adding a hypothetical product-rack layout, saved as a new PNG file. ## Quick Start Ask the agent to use $imagegen to edit the attached reference image, preserving the room geometry and camera perspective, and save the result to a new output file.

Frequently Asked Questions about codex-imagegen

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

FAQPage Schema
How do I generate an image with Codex ImageGen?▼

Include $imagegen in your request with a concrete prompt describing subject, composition, style, and lighting. The host route uses gpt-image-2 and saves the result to your requested output path.

How do I edit an existing image with the GPT Image API?▼

Run generate_image.py with --mode edit, pass one or more --image reference files, optionally add --mask, and describe what must change and what must stay unchanged. The script calls the /v1/images/edits endpoint with gpt-image-2.

Does gpt-image-2 support transparent backgrounds?▼

No, gpt-image-2 does not support transparent backgrounds, so native alpha output cannot be promised. Use auto or opaque background settings and plan for a separate post-processing step if transparency is required.

Where does the script read the OpenAI API key from?▼

By default it reads the active provider's OPENAI_API_KEY and base_url from ~/.codex/config.toml. Use --no-codex-config with the OPENAI_API_KEY environment variable for a separate configuration, and the key is never printed or persisted.

When should I use the API route instead of $imagegen?▼

Use the API route only when the host ImageGen capability is unavailable in the active Codex runtime and the user has approved API billing. The host route is preferred because it uses Codex usage limits and needs no key in the task environment.