For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
    • Overview
  • Tracing
  • Gateway
      • Claude Code
      • Codex CLI
      • Gemini CLI
      • OpenCode
  • Others
  • Migrating
    • Braintrust
    • Portkey
    • Langfuse
LogoLogo
DiscordPlatform
On this page
  • Setup
  • Switch models
GatewayCoding Agents

Codex CLI (gateway)

Was this page helpful?
Previous

Gemini CLI (gateway)

Next
Built with

Route Codex CLI’s LLM calls through the Respan gateway for automatic logging, caching, and model switching. Only your RESPAN_API_KEY is needed.

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 needed — the Respan gateway handles provider authentication.

3

Configure Codex

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

1model = "openai/gpt-5.5" # provider prefix required for Codex CLI
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. The wire_api = "responses" setting tells Codex to use the HTTP Responses API instead of WebSockets, which the gateway supports.

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 = "openai/gpt-5.5"
2# model = "openai/claude-sonnet-4-5-20250929"
3# model = "openai/gemini-2.5-flash"

See the full model list.