Codex CLI (gateway)
Route Codex CLI’s LLM calls through the Respan gateway for automatic logging, caching, and model switching. Codex uses the OpenAI Responses API, which the gateway serves at https://api.respan.ai/api/responses, so only your RESPAN_API_KEY is needed.
Setup
Set environment variable
No OPENAI_API_KEY is needed in your shell. The Respan gateway handles provider authentication.
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. Both model = "gpt-5.5" and the provider-prefixed model = "openai/gpt-5.5" work.
Switch models
Change the model parameter in ~/.codex/config.toml to use any OpenAI model the gateway exposes.
See the full model list.