From benedictking-skills
Generates and edits images using gpt-image-2 via a configurable OpenAI-compatible API. Use when creating visual assets, illustrations, or image variations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/benedictking-skills:gpt-image-2-apiThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate and edit images with gpt-image-2 through a third-party OpenAI-compatible API using .env-configured OPENAI_API_KEY and OPENAI_BASE_URL values. Use when the user asks to create images, edit reference images, create visual assets, illustrations, or image variations with a configurable API endpoint.
Generate and edit images with gpt-image-2 through a third-party OpenAI-compatible API using .env-configured OPENAI_API_KEY and OPENAI_BASE_URL values. 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-2OPENAI_IMAGE_PROTOCOL: openai_images or openai_chat, defaults to openai_imagesOPENAI_IMAGE_SIZE: image size, defaults to 1024x1024OPENAI_IMAGE_QUALITY: optional image qualityOPENAI_IMAGE_N: number of images (1-10), defaults to 1OPENAI_IMAGE_OUTPUT_FORMAT: optional output format (png, jpeg, webp)OPENAI_IMAGE_FORMAT: legacy alias for OPENAI_IMAGE_OUTPUT_FORMATOPENAI_IMAGE_RESPONSE_FORMAT: optional response format (url, b64_json)OPENAI_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_PARTIAL_IMAGES: optional streaming partial image count 0–3OPENAI_IMAGE_INPUT_FIDELITY: optional edit fidelity (high, low)OPENAI_IMAGE_STYLE: optional generation style for dall-e-3 (vivid, natural)OPENAI_IMAGE_STREAM: optional openai_images SSE toggle (true, false)OPENAI_IMAGE_USER: optional end-user identifierOPENAI_IMAGE_EXTRA_JSON: optional JSON object merged into the request bodyscripts/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, --background, --output-format, or streaming image events.--image <path> arguments to edit/reference an input image.--mask <path> or --mask auto only with openai_images edits.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.
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 | 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, auto |
output-format | no | string | endpoint default | png, jpeg, webp |
response-format | no | string | endpoint default | url, b64_json; mainly for DALL·E-compatible responses |
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 |
partial-images | no | integer | endpoint default | Streaming partial image count 0–3 |
input-fidelity | no | string | endpoint default | Edit fidelity: high, low |
style | no | string | endpoint default | Generation style for dall-e-3: vivid, natural |
user | no | string | — | End-user identifier |
format | no | string | — | Legacy alias for output-format |
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 currently documents the classic GPT image set: auto, 1024x1024, 1536x1024, 1024x1536dall-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.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub benedictking/benedictking-skills