Connect Codex or Claude Code directly to RouteAll

Choose your coding tool first, then follow the steps for your operating system. One sk-ra- key plus one base URL — your existing coding agent runs against every model on RouteAll.

Tool
System

Keep the key private. It is only stored in this browser tab and sent nowhere. Current key: sk-ra-your-key

Configuration steps

Download Codex, get a RouteAll API Key, then write the Codex provider configuration so Codex talks to RouteAll instead of ChatGPT.

1

Install Codex

Download and install the Codex desktop app for macOS, or install the Codex CLI from Terminal.

npm install -g @openai/codex@latest
2

Get a RouteAll API Key

Sign in, create an API Key in Console → API Keys, and copy the value that starts with sk-ra-.

3

Set the API key environment variable

Open Terminal, write the key to ~/.zshrc. For the Codex desktop app or VS Code launched from Finder, also write the macOS GUI environment variable.

echo 'export OPENAI_API_KEY="sk-ra-your-key"' >> ~/.zshrc
source ~/.zshrc

launchctl setenv OPENAI_API_KEY "sk-ra-your-key"
4

Back up and write the Codex config

This backs up the current config first, then writes a minimal RouteAll config.

mkdir -p ~/.codex/backups
cp ~/.codex/config.toml ~/.codex/backups/config.toml.before-routeall.$(date +%Y%m%d%H%M%S) 2>/dev/null || true

cat > ~/.codex/config.toml <<'EOF'
model = "deepseek-v4-pro"
model_provider = "routeall"

[model_providers.routeall]
name = "RouteAll"
base_url = "https://routeall.ai/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
requires_openai_auth = false
EOF

New users can copy and run this directly. If you already use MCP, plugins, or project trust settings in Codex, keep your existing file and manually add or update only model, model_provider, and the [model_providers.routeall] block shown above.

5

Restart and verify

Fully quit Codex before reopening it (Codex > Quit Codex). If it still opens the login page, restart the computer, then open Codex and send "reply only ok".

API Debug

Send a chat completion request and view the result. The key is only used in this browser tab and is never saved.

1

Prepare a test request

Paste your RouteAll API Key above, then copy and run the curl command below.

2

Copy and run the curl command

Open Terminal/PowerShell and copy this command. In PowerShell, use curl.exe if curl is treated as an alias.

curl https://routeall.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-ra-your-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"reply only ok"}]}'

Restore the official configuration

Use this when you stop using a RouteAll Key or want to return to the official ChatGPT / Anthropic flow.

1

Back up and remove the RouteAll config

For Codex, restore the official config and unset the environment variable.

mkdir -p ~/.codex/backups
cp ~/.codex/config.toml ~/.codex/backups/config.toml.before-restore.$(date +%Y%m%d%H%M%S) 2>/dev/null || true

cat > ~/.codex/config.toml <<'EOF'
# Official Codex uses your ChatGPT / Codex account.
# Leave this file without a routeall model_provider block.
EOF

launchctl unsetenv OPENAI_API_KEY

For Claude Code, remove the two environment variables instead:

2

Unset Claude environment variables

Remove ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.

unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN
sed -i '' '/ANTHROPIC_BASE_URL/d;/ANTHROPIC_AUTH_TOKEN/d' ~/.zshrc

FAQ

Common checks for the RouteAll direct connection and restoring the official config.

Sign in, create an API Key in Console → API Keys, and copy the value that starts with sk-ra-. If you already have a valid RouteAll Key, use it directly in the configuration steps.