codex-image-plugin
Generate or edit raster images through an OpenAI-compatible image API. Use when the user provides an image API URL and key, asks to use a configured image model, lists available image models, or requests new images, reference-image edits, compositing, masks, cleanup, mockups, or illustrations.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- codex-image-plugin
- description
- Generate or edit raster images through an OpenAI-compatible image API. Use when the user provides an image API URL and key, asks to use a configured image model, lists available image models, or requests new images, reference-image edits, compositing, masks, cleanup, mockups, or illustrations.
02 资源文件 2
- 参考文档agents/openai.yaml264 B
- 脚本scripts/image.py16.7 KB
03 SKILL.md 正文
Codex Image Plugin
Use scripts/image.py as the API wrapper. It accepts an explicit endpoint URL, API key, and model, or reads them from OPENAI_BASE_URL/OPENAI_API_KEY/IMAGE_MODEL and the active Codex provider in ~/.codex/config.toml (base_url, OPENAI_API_KEY, image_model). The selected --model is passed through unchanged, so the endpoint can expose any compatible image model. Do not print, persist, or reuse a Codex session bearer token as an image API key.
Workflow
- Decide whether the request is
models,generate, oredit. - If the user supplied a URL and key, pass them with
--base-urland--api-keyor use environment variables. Prefer environment variables when the key should not appear in shell history. - Use
modelsto inspect the endpoint before choosing a model. - For edits, obtain the actual input files first. Keep source images unchanged and write new results by default.
- Save user-facing results under
outputs/unless the user requests another path, then inspect the result and report exact paths.
List available models
python3 <plugin-root>/skills/codex-image-plugin/scripts/image.py models \
--base-url "https://api.example.com/v1" \
--api-key "$OPENAI_API_KEY" \
--image-only
The command prints model IDs only; it never prints the key.
Generate with any selected model
python3 <plugin-root>/skills/codex-image-plugin/scripts/image.py generate \
--base-url "https://api.example.com/v1" \
--api-key "$OPENAI_API_KEY" \
--model "gpt-image-2" \
--prompt "A clean product photo of a ceramic mug on a white studio background" \
--out outputs/mug.png \
--quality high \
--size 1024x1024 \
--force
--model is not hardcoded. gpt-image-2 is only an example; use an ID returned by models or the model name documented by the endpoint.
Edit one or more images
python3 <plugin-root>/skills/codex-image-plugin/scripts/image.py edit \
--base-url "https://api.example.com/v1" \
--api-key "$OPENAI_API_KEY" \
--model "gpt-image-2" \
--image work/input.png \
--prompt "Change only the background. Preserve the subject exactly: same shape, pose, proportions, colors, lighting, and details." \
--out outputs/edited.png \
--force
Repeat --image for multiple references. Use --mask mask.png for localized edits. A mask must be a PNG with alpha: transparent pixels are editable and opaque pixels are preserved. --mask-ring creates a temporary ring mask for a square image.
Prompting and validation
Separate mutable and protected content. For a localized edit, describe exactly what may change and preserve the subject's shape, pose, proportions, colors, lighting, and details. For a new image, specify the asset type, subject, setting, composition, style, lighting, exact text, and constraints. Use --dry-run to validate a request without making an API call. Model-specific limits such as supported sizes, masks, formats, or transparency are determined by the endpoint; report API errors without hiding them.
04 同仓库更多 Skills
worktable-review-with-annotations
Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.
worktable-find-and-synthesize-context
Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.
worktable-create-or-update-docs
Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.
worktable-create-or-manage-records
Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.
worktable-create-or-manage-interactive-html
Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.
worktable-collaborate-threads
Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.