← Docs

Connect OpenAI Codex CLI / App to LaRouter

Use one LaRouter API key for your configured accounts. Each account retains its own quota.

Option 1: Use Configure

Sign in and select your local configuration file. Apply LaRouter fills your key and model and writes the file immediately; Reset defaults also writes immediately. If your browser cannot write local files, follow the manual instructions.

Configuration file location

macOS
~/.codex/config.toml
Linux
~/.codex/config.toml
Windows
%USERPROFILE%\.codex\config.toml

These are default locations. For a tool running in WSL, use its Linux path inside WSL. If you changed the configuration directory, select the tool’s actual file. Your browser can only read or write files you select.

Option 2: Configure manually

Back up your files and replace only the placeholders shown below. Codex already uses gpt-5.6-sol. Use model names without router prefixes such as cx/. Keep tool-required local provider bindings such as larouter/ where shown, and preserve unrelated settings.

Before you start

Retrieve your assigned key in the portal and make sure a Codex account is connected. Codex uses gpt-5.6-sol by default. Shell examples use Bash or zsh on macOS/Linux. Replace YOUR_API_KEY with your assigned key.

Environment
export LAROUTER_API_KEY="YOUR_API_KEY"
Available models
curl https://i-larouter.lapage.vn/v1/models \
  -H "Authorization: Bearer $LAROUTER_API_KEY"

1. Connect coding and agent CLI tools

For Codex CLI installed on your computer, back up ~/.codex/config.toml and merge the settings below. Keep model and model_provider at the top, before any [section]. Replace YOUR_API_KEY; the model is already set to gpt-5.6-sol without a router prefix.

~/.codex/config.toml
model = "gpt-5.6-sol"
model_provider = "larouter"

[model_providers.larouter]
name = "LaRouter"
base_url = "https://i-larouter.lapage.vn/v1"
wire_api = "responses"
requires_openai_auth = false
supports_standalone_web_search = true
experimental_bearer_token = "YOUR_API_KEY"
http_headers = { "x-openai-actor-authorization" = "larouter" }
Start a new Codex session
codex

Start a new Codex session and send a short prompt to verify it. Codex uses Responses; do not set its endpoint to /chat/completions. For other agent CLIs, check support for a custom endpoint, Bearer key, and a compatible protocol. Set experimental_bearer_token inside [model_providers.larouter], with only the API key (no Bearer prefix). Use inline http_headers in the same provider table. Replace the old [model_providers.larouter.http_headers] block, omit Authorization, and retain any other custom headers inside the inline table.

Codex CLI | LaRouter setup instructions