RouteMux Docs
IntegrationsDev tool

Codex CLI

Run OpenAI Codex CLI against RouteMux by overriding the base URL and key.

Codex CLI speaks the OpenAI protocol, so RouteMux is a drop-in base URL swap.

Configure

export OPENAI_BASE_URL="https://api.routemux.com/v1"
export OPENAI_API_KEY="sk-..."               # your RouteMux key

This base URL does keep /v1

Unlike the Anthropic variable, the OpenAI base URL includes /v1 — OpenAI clients append only the operation path (/chat/completions). Getting these two backwards is the single most common misconfiguration.

Pick a model

export OPENAI_MODEL="openai/gpt-5.5"

GET /v1/models returns exactly the models your key can call — treat it as the source of truth rather than a published catalogue.

Verify

curl https://api.routemux.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.5","messages":[{"role":"user","content":"ping"}]}'

Notes

  • Streaming works unchanged; RouteMux forwards SSE without buffering.
  • Billing is per real usage, settled after the upstream finishes. Timeouts are not billed.
  • A 402 means an empty wallet, not a bad request.

On this page