Create a GPT-Image-2 Skill for Codex
Create a small Codex skill that routes real image-generation requests to the GPT88 Images API and saves the resulting files locally.
Why use a skill
Asking a text model to “generate an image” may produce a prompt, SVG, or HTML instead of a real image. A dedicated skill keeps the text model responsible for planning and uses the Images API for the actual bitmap output.
Prepare the API key
Create an API key in the GPT88 Consoleand keep it in a local environment variable or secret manager. Never commit it or put it in frontend code.
export GPT88_API_KEY="your-gpt88-api-key"
export OPENAI_API_KEY="$GPT88_API_KEY"
export OPENAI_BASE_URL="https://img.gpt88.cc"Create the skill
Create ~/.codex/skills/gpt-image-2/SKILL.md. A single SKILL.md is enough for the basic workflow.
---
name: gpt-image-2
description: Generate images, posters, illustrations, UI visuals, and avatars with GPT88.
tools: Bash
---
# GPT Image 2 Generator
Use the GPT88 Images API when the user needs a real image file. Do not pretend that a text model or an
SVG/HTML response is an image-generation result.
Default configuration:
- Model: gpt-image-2
- Base URL: https://img.gpt88.cc
- Endpoint: /v1/images/generations
- size: 1024x1024
- quality: high
- n: 1
Execution:
1. Expand a short prompt into a concrete visual brief
2. Read GPT88_API_KEY from the environment
3. Call the Images API
4. Decode b64_json
5. Save to output/imagegen/
6. Return the final file pathTest with cURL
Run one minimal request before asking Codex to call the skill automatically. This verifies the key, balance, network route, JSON parser, and base64 utility independently.
mkdir -p output/imagegen
curl -s https://img.gpt88.cc/v1/images/generations \
-H "Authorization: Bearer $GPT88_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A dark technology cover for an API documentation site, no text",
"size": "1024x1024",
"quality": "high",
"n": 1
}' > output/imagegen/response.json
jq -r '.data[0].b64_json' output/imagegen/response.json | base64 -d > output/imagegen/doc-cover.pngUse it in Codex
Start a new Codex session after creating the skill. Ask Codex to use gpt-image-2, specify the subject, style, size, and output directory, and ask it to preserve older files instead of overwriting them.
Use the gpt-image-2 skill to create a dark technology cover for the GPT88 API docs, with no text.
Use the gpt-image-2 skill to create three social-media background images about AI token usage. Save them under output/imagegen/ and do not overwrite existing files.Prompt and cost practices
- Start with 1024x1024 and n=1 to validate direction before batch generation.
- Describe subject, scene, composition, light, material, and exclusions instead of stacking quality adjectives.
- For posters and UI visuals, reserve clean space for later copy.
- Use a text model for prompt refinement; call gpt-image-2 only when a real image is needed.
- Review a prompt list before starting a costly batch.
Troubleshooting
jq: command not found
Install jq or parse JSON with Node/Python.
base64: invalid option -- d
On macOS, use base64 -D.
401 Unauthorized
Check that GPT88_API_KEY exists, is complete, and has available balance.
Empty image
Inspect response.json for an error body before decoding b64_json.For the underlying API contract, see the image generation API guide. For model capabilities, open the gpt-image-2 model page.