Claude Code skill for generating and editing images with OpenAI's gpt-image-2
概览
A small, script-first Agent Skill for generating and editing images through OpenAI's gpt-image-2 Image API. The repository ships maintained CLI code so an agent chooses an operation and passes flags instead of inventing an API call. The distributable skill contains . Production runtime: four focused Python files. uv resolves the pinned OpenAI SDK on first use. - Python 3.10 or newer - uv - An OpenAI API key with access to gpt-image-2 - API network access from the runtime OpenAI may require API organization verification for GPT Image models. Preferred for CI, hosted shells, and existing OpenAI setups: Convenient for an interactive local machine: The second command hides terminal input and stores the key in a user-owned operating-system config directory with owner-only permissions on POSIX. It never writes into gpt-image/, so repackaging or updating the skill cannot include the configured key. Remove it with:
README
以下为原文 README 节选,完整内容请查看原文。
GPT Image 2 skill
A small, script-first Agent Skill for generating and editing images through OpenAI’s gpt-image-2 Image API.
The repository ships maintained CLI code so an agent chooses an operation and passes flags instead of inventing an API call. The distributable skill contains no API key, .env, generated image, or dependency cache.
What is included
gpt-image/
├── SKILL.md
├── agents/openai.yaml
├── references/prompting-guide.md
└── scripts/
├── _common.py
├── configure.py
├── edit.py
└── generate.py
Production runtime: four focused Python files. uv resolves the pinned OpenAI SDK on first use.
Requirements
- Python 3.10 or newer
uv- An OpenAI API key with access to
gpt-image-2 - API network access from the runtime
OpenAI may require API organization verification for GPT Image models.
Configure without modifying the skill
Preferred for CI, hosted shells, and existing OpenAI setups:
export OPENAI_API_KEY="your-key"
Convenient for an interactive local machine:
python gpt-image/scripts/configure.py
The second command hides terminal input and stores the key in a user-owned operating-system config directory with owner-only permissions on POSIX. It never writes into gpt-image/, so repackaging or updating the skill cannot include the configured key. Remove it with:
python gpt-image/scripts/configure.py --remove
Do not put credentials in SKILL.md, .env files beside the scripts, prompts, or archives. In a hosted environment, the host must inject OPENAI_API_KEY; a skill upload cannot do that for you.
Run directly
Generate:
uv run --script gpt-image/scripts/generate.py \
--prompt "A vintage 1960s travel poster for Kyoto in autumn" \
--size 1024x1536 \
--quality high \
--output kyoto.png
Edit:
uv run --script gpt-image/scripts/edit.py \
--prompt "Replace the sky with a thunderstorm; preserve everything else" \
--images photo.jpg \
--output photo-stormy.png
Composite:
uv run --script gpt-image/scripts/edit.py \
--prompt "Place the dog from Image 2 next to the person in Image 1; match scale and light" \
--images scene.png dog.png \
--output composite.png
Run either script with --help for the complete, current CLI. Existing output files are protected unless --force is supplied.
Install as a local skill
Clone the repository, then copy or link the gpt-image/ directory itself into the skill directory used by your agent. The required layout is /gpt-image/SKILL.md; cloning the whole repository directly to that path leaves the manifest one level too deep.
For example:
git clone https://github.com/dshark3y/gpt-image-2-skill.git
mkdir -p ~/.claude/skills
cp -R gpt-image-2-skill/gpt-image ~/.claude/skills/gpt-image
Restart or reload the agent after installing.
Build a clean archive
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add dshark3y/gpt-image-2-skill