Codex CLI
5/20/26Less than 1 minute
Codex CLI is OpenAI's official coding CLI for the GPT-5 codex family.
Prerequisites
- Codex CLI installed
- A key in a group containing GPT-5 codex (recommended:
codex)
Config directory
| OS | Path |
|---|---|
| macOS / Linux | ~/.codex/ |
| Windows | %userprofile%\.codex\ |
Create the directory manually if it doesn't exist. Two files needed: config.toml and auth.json.
config.toml
model = "gpt-5.1-codex"
model_provider = "pulseneko"
[model_providers.pulseneko]
name = "PulseNeko Bridge"
base_url = "https://bridge.pulseneko.com/v1"
wire_api = "responses"
requires_openai_auth = trueFields:
model— default model (switchable in-session)wire_api = "responses"— Codex CLI uses/v1/responses, not chat completionsrequires_openai_auth = true— sendsAuthorization: Bearer sk-…
auth.json
{
"OPENAI_API_KEY": "sk-your-key"
}AGENTS.md (optional)
~/.codex/AGENTS.md is injected as a global system prompt:
- Preferred language
- Code style conventions
- Things never to do (e.g.
git push --force)
Recommended models
| Model | Best for |
|---|---|
gpt-5.1-codex | Daily driver |
gpt-5.1-codex-mini | Lighter tasks, cheap |
gpt-5.3-codex | Newer reasoning (if available in your group) |
Full list on Model Catalog under codex group.
Verify
codex| Error | Cause |
|---|---|
provider not found | model_provider doesn't match [model_providers.xxx] section |
401 | Wrong key in auth.json |
wire_api mismatch | Must be responses, not chat |
Switching model
In-session: /model gpt-5.1-codex-mini etc.