Tool Setup
Use a Codex Skill to Generate Images
Learn how to use imagegen-compatible Skill for Codex image generation when using the GetToken relay service.
When using the GetToken relay service, Codex cannot generate images directly through the built-in client ImageGen.
Built-in ImageGen needs a key that can connect directly to the OpenAI Images API. GetToken provides a relay service API key, and that key does not take over the direct ImageGen path inside Codex.
Therefore, image generation with the GetToken relay service must use the imagegen-compatible Skill.
Ask Codex to Install It
You can send this directly to Codex:
Please install this Codex skill: https://cnb.cool/youidian/imagegen-compatible
Requirements:
1. Clone the repository to ${CODEX_HOME:-$HOME/.codex}/skills/imagegen-compatible.
2. Before installation, check whether the target directory already exists. If it exists, ask me whether to update, overwrite, or skip. Do not delete it directly.
3. After installation, confirm SKILL.md, scripts/image_gen.py, agents/openai.yaml, and references/config.md exist.
4. If ~/.codex/skills/.system/skill-creator/scripts/quick_validate.py exists, run it to validate the skill.
5. Remind me to restart Codex.
Restart Codex after installation.
Requirement
When generating images in Codex, image generation tasks must be handled by imagegen-compatible.
Do not use:
- Built-in Codex ImageGen
- Image generation paths that depend on an official OpenAI direct key
Use:
imagegen-compatibleSkill- GetToken API Key
- OpenAI-compatible Images API endpoint
Configure the Endpoint
imagegen-compatible reads two environment variables:
OPENAI_API_KEY
OPENAI_BASE_URL
macOS / Linux:
export OPENAI_API_KEY="<your GetToken API Key>"
export OPENAI_BASE_URL="https://api.gettoken.dev/v1"
Windows PowerShell:
$env:OPENAI_API_KEY = "<your GetToken API Key>"
$env:OPENAI_BASE_URL = "https://api.gettoken.dev/v1"
Do not put real API keys in public repositories or public screenshots.
Install Location
The Skill must be installed under the .codex/skills directory used by the environment where Codex actually runs.
macOS / Linux:
${CODEX_HOME:-$HOME/.codex}/skills/imagegen-compatible
Windows PowerShell:
$env:USERPROFILE\.codex\skills\imagegen-compatible
Windows WSL:
~/.codex/skills/imagegen-compatible
If Codex runs in WSL, install the Skill inside WSL. If Codex runs in native Windows, install it under the Windows user directory.
Troubleshooting
Why not use built-in ImageGen directly
Built-in Codex ImageGen requires a key that can connect directly to the OpenAI Images API. When using the GetToken relay service, that direct path does not work, so imagegen-compatible must handle image generation.
Codex Cannot Find the Skill
Confirm the Skill is installed under the .codex/skills directory used by the active Codex environment, then restart Codex.
Windows Installation Does Not Work
Confirm whether Codex runs in native Windows or WSL. The Skill must be installed in the same environment.
Generation Fails
Check:
OPENAI_API_KEYis correct.OPENAI_BASE_URLincludes/v1.- The current endpoint supports the Images API.
- The output directory exists or is writable.