Codex CLI
Codex CLI is OpenAI's official command-line coding assistant, best paired with the gpt-5.5 model.
Manage multiple providers
If you use the official OpenAI account alongside several gateways, CC Switch is much easier than editing config.toml by hand.
Install
# pick one
npm install -g @openai/codex
brew install codexVerify:
codex --versionConfigure
Edit ~/.codex/config.toml (%USERPROFILE%\.codex\config.toml on Windows). Create it if it doesn't exist:
model = "gpt-5.5"
model_provider = "tokone"
[model_providers.tokone]
name = "TokOne"
base_url = "https://api.tokone.ai/v1"
wire_api = "responses"wire_api must be responses
Codex CLI uses OpenAI's Responses API (not Chat Completions). Getting wire_api wrong returns unsupported endpoint.
Provide your API Key
Pick one:
Option A: codex login (recommended)
codex login
# paste sk-xxx when promptedCredentials are written to ~/.codex/auth.json and persist across terminal sessions.
Option B: environment variable
export OPENAI_API_KEY="sk-xxx"$env:OPENAI_API_KEY = "sk-xxx"The env-var approach only affects the current terminal session. To persist it, add it to ~/.zshrc (macOS) / ~/.bashrc (Linux) / Windows system environment variables.
Verify
codex "Describe this project in one sentence"A reply means it works. You can also confirm the request landed on the "Usage" page of the TokOne console.
FAQ
unsupported endpoint
wire_api is wrong. It must be responses, not chat_completions.
Config changes don't take effect
Make sure model_provider exactly matches the xxx in [model_providers.xxx] (case-sensitive). Codex looks up the provider block by this field at startup.
Model name returns 404
Write the full model name: gpt-5.5, not codex or gpt-codex.
Different keys per project
~/.codex/config.toml is global. To use a different key per project, drop a .codex/config.toml in the project directory to override it (Codex reads the nearest one).
Next steps
- Models — pricing and context for
gpt-5.5 - API Endpoints — protocol notes