gpt-image-2
Installation
Summary
Full OpenAI-compatible GPT Image 2 API coverage with text-to-image, edits, and streaming responses.
- Three subcommands cover all routes:
generationsfor text-to-image,editsfor mask-based image manipulation, andresponsesfor streaming and mixed text+image flows - Strict pre-flight validation enforces model constraints on size, aspect ratio, and feature combinations; includes
--dry-runmode to inspect payloads before sending - Supports multi-image batches, partial image previews, SSE streaming, and OpenAI-compatible gateways via environment variables or CLI flags
- Output patterns like
image-{index}.pnghandle both single and batch workflows; raw JSON responses can be saved for debugging
SKILL.md
GPT Image 2
A single Python entrypoint that covers every GPT Image 2 route, with strict pre-flight validation of the model's size, aspect, and feature constraints.
Workflow
- Open references/config.md to pick environment variables and defaults.
- Open references/api-surface.md to choose between
generations,edits, andresponses. - Prefer
OPENAI_BASE_URL=https://api.openai.com/v1unless the user asks for a different OpenAI-compatible endpoint. - Use
gpt-image-2forgenerationsandedits; use a text-capable Responses model such asgpt-5.4forresponses. - Run
scripts/gpt_image.pywith one of the three subcommands. - Add
--dry-runfirst when the payload shape is the main risk. - Add
--save-response <path>when the raw JSON body or SSE event stream needs to be kept for debugging.
Commands
Text-to-image through the public Images API: