
Gpt Image 2
Call GPT Image 2 through one Python CLI for text-to-image, masked edits, multi-reference edits, and Responses API streaming with validated sizes and progressive previews.
Overview
GPT Image 2 is an agent skill most often used in Build (also Launch distribution, Grow content) that generates, edits, and streams GPT Image 2 outputs through one OpenAI-compatible Python CLI.
Install
npx skills add https://github.com/gargantuax/openskills --skill gpt-image-2What is this skill?
- Single entrypoint with three subcommands: generations, edits, and responses (image_generation tool)
- Streaming SSE with optional partial_images progressive previews
- Pre-flight validation for GPT Image 2 size, aspect, pixel count, transparency, output_compression, and stream+n constrai
- Base64 de-duplication and multi-image filename templating (out-{index}.png)
- Zero third-party Python dependencies—stdlib only with CLI, env, and .env config override order
- 3 CLI subcommands: generations, edits, responses
- Python 3.10+ with zero third-party dependencies
- Multi-image output template out-{index}.png
Adoption & trust: 16.6k installs on skills.sh; 2 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need GPT Image 2 generations, edits, and Responses-tool image output from your agent without juggling separate HTTP clients and silently violating model size or streaming rules.
Who is it for?
Solo builders with an OpenAI-compatible gpt-image-2 endpoint who want a single audited script inside Claude Code, Codex, or Cursor skills.
Skip if: Builders who only need DALL·E 2/3 endpoints or heavy image post-processing pipelines outside the GPT Image 2 contract.
When should I use this skill?
When the user wants to generate, edit, or stream GPT Image 2 outputs through an OpenAI-compatible API (default prompt: use $gpt-image-2).
What do I get? / Deliverables
You get validated API calls and saved PNGs (including multi-image out-{index}.png sets) with optional streaming previews, ready to drop into UI mocks or campaign assets.
- Saved PNG files (single or out-{index}.png batches)
- Validated API request payloads
- Optional streaming partial image previews
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Visual asset generation sits in build when implementing UI and marketing surfaces, but the same CLI supports launch creatives and grow lifecycle imagery. Frontend is the primary shelf because generations and edits target product visuals, icons, and mock imagery rather than backend service code.
Where it fits
Batch-generate hero and empty-state illustrations sized to GPT Image 2 constraints for a React landing page.
Exercise the Responses image_generation tool with mixed text and reference images inside an agent workflow.
Produce campaign stills and social crops via edits subcommand with mask files.
Refresh lifecycle email headers using multi-image generations with out-{index}.png naming.
How it compares
A focused GPT Image 2 CLI skill—not a general creative suite or hosted design MCP with asset libraries.
Common Questions / FAQ
Who is gpt-image-2 for?
Indie developers and agent users who ship product and marketing visuals through OpenAI-compatible gateways and want procedural, repeatable image API calls.
When should I use gpt-image-2?
Use it in Build for UI mock assets and illustrations, in Launch for ad and store imagery, and in Grow when refreshing lifecycle or content visuals—whenever the task names GPT Image 2 generations, edits, or responses streaming.
Is gpt-image-2 safe to install?
The skill calls external image APIs with your credentials; review the Security Audits panel on this page, keep API keys out of repos, and scope network access to your chosen gateway only.
SKILL.md
READMESKILL.md - Gpt Image 2
interface: display_name: "GPT Image 2" short_description: "Complete GPT Image 2 skill for generations, edits, and responses." default_prompt: "Use $gpt-image-2 to generate, edit, or stream GPT Image 2 outputs through an OpenAI-compatible API." # gpt-image-2 An agent skill for the full **GPT Image 2** surface on any OpenAI-compatible gateway. One Python entrypoint covers `images/generations`, `images/edits`, and `responses` (with the `image_generation` tool), including streaming and partial-image previews. Built for Codex, Claude, and other skill-aware agents, but the script also runs fine by hand. ## Features - Three subcommands in one CLI: `generations`, `edits`, `responses`. - Text-to-image, multi-image batches, mask edits, multi-reference edits, mixed text + image input. - Streaming (SSE) with optional `partial_images` progressive previews. - Strict pre-flight validation of GPT Image 2 constraints (size, aspect, pixel count, transparent background, `output_compression`, `stream` + `n`, and unsupported `response_format` usage on OpenAI GPT image models). - Automatic base64 de-duplication and multi-image filename templating (`out-{index}.png`). - Config via CLI flags, process environment, or `.env` — with a predictable override order. - Zero third-party dependencies (standard library only). ## Requirements - Python 3.10+ - An OpenAI-compatible endpoint that serves `gpt-image-2` (default: `https://api.openai.com/v1`). - For `responses`, a text-capable Responses model such as `gpt-5.4` when using the hosted `image_generation` tool. - `OPENAI_API_KEY`. ## Install After publishing the repository, the recommended install path is through [Skills](https://skills.sh/): ```powershell pnpm dlx skills add https://github.com/GargantuaX/openskills --skill gpt-image-2 ``` Equivalent shorthand: ```powershell pnpm dlx skills add GargantuaX/openskills@gpt-image-2 ``` If you want the whole collection instead, install: ```powershell pnpm dlx skills add GargantuaX/openskills ``` You can also drop the folder into your agent's skill directory, or clone/copy it anywhere and invoke the script directly. Register with Codex by pointing at [agents/openai.yaml](./agents/openai.yaml). Claude-style agents can consume [SKILL.md](./SKILL.md) directly. ## Setup After skills.sh Install 1. Set credentials with environment variables, or create a `.env` in the working directory where you will run the script. 2. Start from the repository example [`.env.example`](../../.env.example), then adjust values for your endpoint and model defaults. 3. Run a `--dry-run` command first to confirm the final request shape before making live requests. Minimal `.env`: ```dotenv OPENAI_API_KEY=your-openai-api-key OPENAI_BASE_URL=https://api.openai.com/v1 OPENAI_IMAGE_MODEL=gpt-image-2 OPENAI_RESPONSES_MODEL=gpt-5.4 OPENAI_IMAGE_SIZE=auto OPENAI_IMAGE_QUALITY=high OPENAI_IMAGE_FORMAT=webp OPENAI_IMAGE_TIMEOUT=300 ``` Dry-run check: ```powershell python .\scripts\gpt_image.py responses ` --input-text "Generate a poster for an AI tool launch" ` --output .\out\poster.webp ` --dry-run ``` ## Quick start ```powershell # 1. Configure credentials (either export or put in .env next to the script) $env:OPENAI_API_KEY = "sk-..." $env:OPENAI_BASE_URL = "https://api.openai.com/v1" # 2. Generate python .\scripts\gpt_image.py generations ` --prompt "A bold product hero image" ` --output .\out\hero.webp ``` Built-in defaults now match the example `.env`: `size=auto`, `quality=high`, `format=webp`, `timeout=300`. For `responses`, the default top-level model is `gpt-5.4`; `OPENAI_IMAGE_MODEL` only applies to `generations` and `edits`. See [SKILL.md](./SKILL.md) for the full command catalog, including multi-image batches, masked edits, and streaming Responses. ## Project layout ``` gpt-image-2/ ├─ SKILL.md # Agent-facing entry point (workflow + examples + rules) ├─ README.md # You are here ├─ agents/ │ └─ openai.yaml