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

1

Install Codex CLI

$npm install -g @openai/codex
2

Set environment variable

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

No OPENAI_API_KEY is needed in your shell, but the Responses API route must be enabled for your Respan key.

3

Configure Codex

Add to ~/.codex/config.toml (user-level) or .codex/config.toml (project-level):

1model = "gpt-5.5"
2model_provider = "respan"
3
4[model_providers.respan]
5name = "Respan Gateway"
6base_url = "https://api.respan.ai/api/"
7wire_api = "responses"
8env_key = "RESPAN_API_KEY"

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.

4

Run Codex

$codex "your prompt"

All LLM calls now route through Respan.

Switch models

Change the model parameter in ~/.codex/config.toml to use any supported model.

1model = "gpt-5.5"
2# model = "claude-sonnet-4-5-20250929"
3# model = "gemini/gemini-3.5-flash"

See the full model list.