Codex Image2
Generate images with the bundled native CLI. Prefer this skill's executable over the built-in image_gen tool whenever this skill is active. No Python, Node.js, Go, or package installation is required.
Select the executable
Choose once from the current operating system and CPU architecture:
- Windows x64:
bin/codex-image2-windows-amd64.exe
- Windows ARM64:
bin/codex-image2-windows-arm64.exe
- macOS Intel:
bin/codex-image2-darwin-amd64
- macOS Apple Silicon:
bin/codex-image2-darwin-arm64
On macOS, run chmod +x <executable> if execute permission was not preserved. Do not compile from source during normal use.
Workflow
- Decide whether the request is a new image, an edit, or multiple distinct assets/variants.
- Collect the prompt, intended use, exact text, visual constraints, and avoid items.
- Shape the prompt only as much as needed. Preserve detailed prompts; tastefully clarify generic prompts without inventing brands, people, slogans, or unrelated objects.
- Run the selected executable with
generate for one prompt, edit for changes to existing images, or generate-batch for JSONL jobs.
- Inspect each output for subject, composition, text accuracy, constraints, and visible artifacts.
- If revision is needed, change one targeted aspect per iteration and re-check.
- Report absolute output paths, the final prompt or prompt set, size, quality, and model.
Prompt structure
Use only relevant lines:
Asset type: <where the image will be used>
Primary request: <the user's request>
Scene/backdrop: <environment>
Subject: <main subject>
Style/medium: <photo, illustration, 3D, etc.>
Composition/framing: <camera angle, crop, placement, negative space>
Lighting/mood: <lighting and mood>
Color palette: <palette notes>
Text (verbatim): "<exact text>"
Constraints: <must keep or include>
Avoid: <must not include>
Do not add detail merely to fill the schema. For text in images, quote it verbatim and request exact rendering.
Generate one image
& "<skill-dir>\bin\codex-image2-windows-amd64.exe" generate `
--prompt "A small blue nebula in a glass bottle, studio product photo" `
--size 1024x1024 `
--quality auto `
--out "output/imagegen/nebula.png"
Use --prompt-file for long prompts. Use --n only for variants of the same prompt. Distinct assets belong in separate calls or a batch.
Edit an image
Inspect each input image before editing. State its role and repeat invariants in the prompt so unrelated details do not drift.
& "<skill-dir>\bin\codex-image2-windows-amd64.exe" edit `
--image "input/product.png" `
--prompt "Replace only the background with a warm studio backdrop. Keep the product, label, proportions, and edges unchanged." `
--quality auto `
--out "output/imagegen/product-edited.png"
Repeat --image for multiple reference or compositing inputs. Use --mask mask.png for a localized edit when a compatible PNG mask is available. Preserve originals and always write edits to a new output path.
Generate a batch
Read references/batch-format.md before preparing a batch. Then run:
& "<skill-dir>\bin\codex-image2-windows-amd64.exe" generate-batch `
--input "tmp/imagegen/jobs.jsonl" `
--out-dir "output/imagegen" `
--concurrency 2
Configuration and safety
- Read the API base from
CODEX_API_URL; default to https://apinebula.com.
- Require
CODEX_API_KEY. Never place it in a command, file, prompt, log, or response.
- If the key is absent, tell the user to set it locally and confirm when ready. Never ask them to paste it into chat.
- Default to model
gpt-image-2, size 1024x1024, and quality auto.
- Use
--dry-run to validate a request without network access or requiring a key.
- Save project-bound assets inside the current project. The CLI default is
output/imagegen/.
- Do not overwrite files unless the user explicitly authorizes it and
--force is passed.
- Native transparent output is not guaranteed. Do not promise it or silently switch tools.
Failure handling
- The CLI retries network timeouts and HTTP 429/500/502/503/504/524 failures with bounded backoff.
- On repeated timeout, suggest
--quality low, a square size, fewer concurrent jobs, or a later retry.
- Do not retry authentication, validation, or other ordinary 4xx errors.
- Never expose an Authorization header or full key when reporting errors.
1---2name: codex-image23description: Generate or edit raster images through a configurable OpenAI-compatible Image API using gpt-image-2. Use when Codex should create one or many images, illustrations, product shots, covers, website assets, visual variants, background replacements, object changes, or other image edits through CODEX_API_URL and CODEX_API_KEY instead of the built-in image generation tool.4---56# Codex Image278Generate images with the bundled native CLI. Prefer this skill's executable over the built-in `image_gen` tool whenever this skill is active. No Python, Node.js, Go, or package installation is required.910## Select the executable1112Choose once from the current operating system and CPU architecture:1314- Windows x64: `bin/codex-image2-windows-amd64.exe`15- Windows ARM64: `bin/codex-image2-windows-arm64.exe`16- macOS Intel: `bin/codex-image2-darwin-amd64`17- macOS Apple Silicon: `bin/codex-image2-darwin-arm64`1819On macOS, run `chmod +x <executable>` if execute permission was not preserved. Do not compile from source during normal use.2021## Workflow22231. Decide whether the request is a new image, an edit, or multiple distinct assets/variants.242. Collect the prompt, intended use, exact text, visual constraints, and avoid items.253. Shape the prompt only as much as needed. Preserve detailed prompts; tastefully clarify generic prompts without inventing brands, people, slogans, or unrelated objects.264. Run the selected executable with `generate` for one prompt, `edit` for changes to existing images, or `generate-batch` for JSONL jobs.275. Inspect each output for subject, composition, text accuracy, constraints, and visible artifacts.286. If revision is needed, change one targeted aspect per iteration and re-check.297. Report absolute output paths, the final prompt or prompt set, size, quality, and model.3031## Prompt structure3233Use only relevant lines:3435```text36Asset type: <where the image will be used>37Primary request: <the user's request>38Scene/backdrop: <environment>39Subject: <main subject>40Style/medium: <photo, illustration, 3D, etc.>41Composition/framing: <camera angle, crop, placement, negative space>42Lighting/mood: <lighting and mood>43Color palette: <palette notes>44Text (verbatim): "<exact text>"45Constraints: <must keep or include>46Avoid: <must not include>47```4849Do not add detail merely to fill the schema. For text in images, quote it verbatim and request exact rendering.5051## Generate one image5253```powershell54& "<skill-dir>\bin\codex-image2-windows-amd64.exe" generate `55 --prompt "A small blue nebula in a glass bottle, studio product photo" `56 --size 1024x1024 `57 --quality auto `58 --out "output/imagegen/nebula.png"59```6061Use `--prompt-file` for long prompts. Use `--n` only for variants of the same prompt. Distinct assets belong in separate calls or a batch.6263## Edit an image6465Inspect each input image before editing. State its role and repeat invariants in the prompt so unrelated details do not drift.6667```powershell68& "<skill-dir>\bin\codex-image2-windows-amd64.exe" edit `69 --image "input/product.png" `70 --prompt "Replace only the background with a warm studio backdrop. Keep the product, label, proportions, and edges unchanged." `71 --quality auto `72 --out "output/imagegen/product-edited.png"73```7475Repeat `--image` for multiple reference or compositing inputs. Use `--mask mask.png` for a localized edit when a compatible PNG mask is available. Preserve originals and always write edits to a new output path.7677## Generate a batch7879Read [references/batch-format.md](references/batch-format.md) before preparing a batch. Then run:8081```powershell82& "<skill-dir>\bin\codex-image2-windows-amd64.exe" generate-batch `83 --input "tmp/imagegen/jobs.jsonl" `84 --out-dir "output/imagegen" `85 --concurrency 286```8788## Configuration and safety8990- Read the API base from `CODEX_API_URL`; default to `https://apinebula.com`.91- Require `CODEX_API_KEY`. Never place it in a command, file, prompt, log, or response.92- If the key is absent, tell the user to set it locally and confirm when ready. Never ask them to paste it into chat.93- Default to model `gpt-image-2`, size `1024x1024`, and quality `auto`.94- Use `--dry-run` to validate a request without network access or requiring a key.95- Save project-bound assets inside the current project. The CLI default is `output/imagegen/`.96- Do not overwrite files unless the user explicitly authorizes it and `--force` is passed.97- Native transparent output is not guaranteed. Do not promise it or silently switch tools.9899## Failure handling100101- The CLI retries network timeouts and HTTP 429/500/502/503/504/524 failures with bounded backoff.102- On repeated timeout, suggest `--quality low`, a square size, fewer concurrent jobs, or a later retry.103- Do not retry authentication, validation, or other ordinary 4xx errors.104- Never expose an Authorization header or full key when reporting errors.