/benedictking-skills:gpt-image-2-apifrom benedictking-skills
Generates and edits images using gpt-image-2 family models via an OpenAI-compatible API. Configured through OPENAI_API_KEY and OPENAI_BASE_URL environment variables.
Ships in benedictking-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Generate and edit images with gpt-image-2 family models (gpt-image-2 / 2.5 / 2.6, defaulting to gpt-image-2.6) through a third-party OpenAI-compatible API using .env-configured OPENAI_API_KEY and OPENAI_BASE_URL values. Never uses streaming. Use when the user asks to create images, edit reference images, create visual assets, illustrations, or image variations with a configurable API endpoint.
Two ways to configure API settings (priority: environment variable > .env):
OPENAI_API_KEY, OPENAI_BASE_URL, and optional OPENAI_IMAGE_* overrides.env file: Place in .env, can copy from .env.exampleYou can manage the .env file manually or through skill-master env set.
OPENAI_API_KEY: API key for the third-party endpointOPENAI_BASE_URL: OpenAI-compatible base URL, for example http://127.0.0.1:3688/v1OPENAI_IMAGE_MODEL: image model name, defaults to gpt-image-2.6 (see Models)OPENAI_IMAGE_PROTOCOL: openai_images or openai_chat, defaults to openai_imagesOPENAI_IMAGE_SIZE: image size, defaults to 1024x1024OPENAI_IMAGE_QUALITY: optional image quality (low, medium, high, xhigh, max, auto; xhigh / max need 2.5 or 2.6)OPENAI_IMAGE_COMPLEXITY: optional planning effort low / medium / high, separate from quality; 2.5/2.6 default to highOPENAI_IMAGE_SAFETY_IDENTIFIER: optional end-user identifier (hash it), replaces deprecated OPENAI_IMAGE_USEROPENAI_IMAGE_N: number of images (1-10), defaults to 1OPENAI_IMAGE_OUTPUT_FORMAT: optional output format (png, jpeg, webp, gif, svg)OPENAI_IMAGE_FRAME_COUNT / OPENAI_IMAGE_FRAME_DURATION_MS: GIF only, 2–16 frames and 20–2000 ms per frameOPENAI_IMAGE_SVG_MODEL / OPENAI_IMAGE_SVG_REASONING: optional SVG author model and reasoning effortOPENAI_IMAGE_MARKUP: optional transparent PNG annotation layer path for editsOPENAI_IMAGE_FORMAT: legacy alias for OPENAI_IMAGE_OUTPUT_FORMATOPENAI_IMAGE_RESPONSE_FORMAT: legacy dall-e-* only (url, b64_json); GPT image models always return base64OPENAI_IMAGE_BACKGROUND: optional background (transparent, opaque, auto)OPENAI_IMAGE_MODERATION: optional moderation level (low, auto)OPENAI_IMAGE_OUTPUT_COMPRESSION: optional compression level 0–100 for jpeg / webpOPENAI_IMAGE_INPUT_FIDELITY: optional edit fidelity (high, low); for gpt-image-1.5 / gpt-image-1-mini only, omit for gpt-image-2.xOPENAI_IMAGE_STYLE: legacy dall-e-3 only (vivid, natural); unsupported for GPT image modelsOPENAI_IMAGE_USER: deprecated, use OPENAI_IMAGE_SAFETY_IDENTIFIEROPENAI_IMAGE_EXTRA_JSON: optional JSON object merged into the request body (must not contain stream or partial_images)| Model | Notes |
|---|---|
gpt-image-2.6 | Default. Provider alias, not an official OpenAI model id. Latest generation |
gpt-image-2.6-flare / gpt-image-2.6-sunburst | Official ids. Flare = fast iteration, Sunburst = precise / detailed edits. Official /images/edits default is gpt-image-2.6-sunburst |
gpt-image-2.5 | Provider alias. Previous generation |
gpt-image-2.5-flare / gpt-image-2.5-sunburst | Official ids, each also has a -2026-09-08 snapshot |
gpt-image-2 | Official id, also gpt-image-2-2026-04-21 |
nano-banana-pro / nano-banana-2.1 | Google models on some OpenAI-compatible gateways; if /images/* rejects them, retry with --protocol openai_chat |
Model availability depends on the configured endpoint. Pass --model or set OPENAI_IMAGE_MODEL to switch.
Against the official OpenAI API, bare names such as gpt-image-2.6 / gpt-image-2.5 are not valid: set OPENAI_IMAGE_MODEL=gpt-image-2.6-sunburst (or -flare). gpt-image-1 was shut down on 2026-10-23. gpt-image-1.5, gpt-image-1-mini, chatgpt-image-latest, dall-e-2 and dall-e-3 also exist upstream.
Parameter notes from the official docs (verify against your gateway before relying on them):
quality xhigh / max and complexity apply to 2.5/2.6 Sunburst and Flare; omitting complexity means high, with no separate fee.--mask auto is a gateway extension; the official API expects a mask file upload or a {image_url | file_id} object./images/edits also accepts a JSON body with images: [{image_url | file_id}] (up to 16 images); this script uses multipart uploads, which remain supported.Streaming is intentionally unsupported. Some providers bill each streamed chunk as a separate request, and this script only saves the final image anyway. The script never sends stream / partial_images, and rejects them if they appear in --extra-json or OPENAI_IMAGE_EXTRA_JSON. Do not work around this with raw curl calls that set stream: true.
scripts/gpt-image-2-api.mjs for text-to-image and image-edit requests.OPENAI_* settings are not available from the current environment or this skill's .env, stop and tell the user which variables need to be configured.openai_images generation uses /images/generations with JSON; openai_images editing uses /images/edits with multipart/form-data.OPENAI_IMAGE_PROTOCOL=openai_chat only when the endpoint lacks /images/* support; it does not support --mask, --markup, --background, --output-format, --complexity, or GIF/SVG options.--image <path> arguments to edit/reference an input image.--mask <path>, --mask auto, or --markup <path> only with openai_images edits. --mask and --markup are mutually exclusive.scripts/gpt-image-2-api.mjs — Sends a text prompt, optionally with input images, to the configured OpenAI-compatible endpoint and saves returned images.node scripts/gpt-image-2-api.mjs --prompt "a concise image prompt" --output ./generated-images --size 1024x1024 --n 1 --output-format png
Use --base-url, --model, --protocol, --size, --quality, --n, --output-format, --background, --moderation, --response-format, and --extra-json only when the user or endpoint requires overrides.
Gateway support for these is unverified; expect the upstream to reject them if it has not caught up.
node scripts/gpt-image-2-api.mjs --prompt "a lantern swinging in the wind, looping" --output-format gif --frame-count 9 --frame-duration-ms 200 --output ./generated-images
node scripts/gpt-image-2-api.mjs --prompt "a flat bakery logo" --output-format svg --n 1 --output ./generated-images
svg is generation-only and requires --n 1; the saved file is .svg. GIF output needs no streaming.
Markup-guided edit (2.5/2.6): a transparent PNG annotation layer over the first input image, same dimensions, not flattened into it.
node scripts/gpt-image-2-api.mjs --prompt "recolor the circled vase" --image ./kitchen.png --markup ./overlay.png --output ./edited-images
node scripts/gpt-image-2-api.mjs --prompt "make the dog wear a red scarf" --image ./input.png --output ./edited-images
Multiple input images are supported by repeating --image. --input is accepted as an alias for --image.
Mask example for openai_images:
node scripts/gpt-image-2-api.mjs --protocol openai_images --prompt "replace the background" --image ./input.png --mask ./mask.png --output ./edited-images
Auto-mask example for openai_images:
node scripts/gpt-image-2-api.mjs --protocol openai_images --prompt "remove the background" --image ./input.png --mask auto --background transparent --output-format png --output ./edited-images
Fallback example when the endpoint only supports chat completions:
OPENAI_IMAGE_PROTOCOL=openai_chat node scripts/gpt-image-2-api.mjs --prompt "a concise image prompt" --output ./generated-images
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
prompt | yes | string | — | Text description for generation or edit |
model | no | string | gpt-image-2.6 | Image model name |
n | no | integer | 1 | Number of images, range 1–10 |
size | no | string | 1024x1024 | Output size passed through to the upstream endpoint |
quality | no | string | endpoint default | low, medium, high, xhigh, max, auto; xhigh/max need 2.5/2.6 |
complexity | no | string | high on 2.5/2.6 | Planning effort: low, medium, high |
output-format | no | string | endpoint default | png, jpeg, webp, gif, svg |
frame-count | no | integer | 9 | GIF only: 2–16 frames |
frame-duration-ms | no | integer | 200 | GIF only: 20–2000 ms per frame |
svg-model | no | string | — | SVG only: author model |
svg-reasoning | no | string | — | SVG only: author reasoning effort |
markup | no | path | — | Edits only: transparent PNG annotation layer over the first input image, same dimensions; mutually exclusive with mask |
safety-identifier | no | string | — | Hashed end-user identifier, replaces user |
response-format | no | string | endpoint default | Legacy dall-e-* only: url, b64_json |
background | no | string | endpoint default | transparent, opaque, auto |
moderation | no | string | endpoint default | low, auto |
output-compression | no | integer | endpoint default | Compression 0–100 for jpeg/webp |
input-fidelity | no | string | endpoint default | gpt-image-1.5 / 1-mini only: high, low; omit for 2.x |
style | no | string | endpoint default | Legacy dall-e-3 only: vivid, natural |
user | no | string | — | Deprecated, use safety-identifier |
format | no | string | — | Legacy alias for output-format |
Official limits match the Size Constraints below; resolutions above 2560x1440 are experimental.
The script does not hard-validate size; values are passed through so OpenAI-compatible upstream endpoints can decide what they support.
For the Yunwu-compatible docs currently checked in this project:
/images/generations documents auto, 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160, and 2160x3840/images/edits accepts the same arbitrary WIDTHxHEIGHT strings as generation on 2.x modelsdall-e-2 documents 256x256, 512x512, 1024x1024dall-e-3 documents 1024x1024, 1792x1024, 1024x1792Because provider behavior may differ by endpoint and documentation may lag behind the implementation, this skill forwards size unchanged and lets the upstream API accept or reject it.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (benedictking/benedictking-skills) — no native marketplace selected
npx claudepluginhub p/benedictking-benedictking-skills6 skills in this plugin
/codex-reviewUse this skill when users ask for code review, review pending changes, or inspect the latest commit with Codex-based review workflows. It prepares context, runs project linting, and reviews the result./context7-auto-researchUse this skill when users need current documentation, setup steps, API references, or code examples for a named library, framework, SDK, or API. It fetches up-to-date Context7 docs./exa-searchUse this skill when users need semantic web search, similar-page discovery, result content retrieval, research-paper lookup, GitHub discovery, or structured Exa-powered research./firecrawl-scraperUse this skill when users need to scrape web pages, extract structured page data, take website screenshots, parse PDFs, batch-scrape URLs, or crawl a site with Firecrawl./tavily-webUse this skill when users need current web research, source discovery, URL content extraction, site mapping, crawling, or structured Tavily-powered research.Other plugins' skills for the same job