Codex CLI (gateway)
Codex CLI (gateway)
Route Codex CLI’s LLM calls through the Respan gateway for automatic logging, caching, and model switching after Responses API access is configured for your Respan key.
Setup
Set environment variable
No OPENAI_API_KEY is needed in your shell, but the Responses API route must be enabled for your Respan key.
Configure Codex
Add to ~/.codex/config.toml (user-level) or .codex/config.toml (project-level):
env_key is the name of the environment variable that holds your API key, not the actual key. Current Codex CLI requires wire_api = "responses"; wire_api = "chat" is rejected by Codex itself. Live verification with a standard Respan gateway key returned a provider-credential error on /api/responses, so use this setup only after Responses API access is configured for your key.
Switch models
Change the model parameter in ~/.codex/config.toml to use any supported model.
See the full model list.