Skip to content

Codex Setup Guide

Install and configure Codex CLI to connect to CodyRouter through a config file.

Codex supports OpenAI-compatible API endpoints and uses local config files for setup.

Step 1: Install Codex

bash
npm install -g @openai/codex@latest

If you hit permission issues on macOS or Linux, use sudo:

bash
sudo npm install -g @openai/codex@latest

Verify Installation

bash
codex --version

If a version number is shown, Codex is installed successfully.

Step 2: Create Config Files

Codex needs two files: config.toml and auth.json.

Create Config Files

Choose your system, then copy the command into Terminal and press Enter.

powershell
if (Test-Path "$env:USERPROFILE\.codex") { Remove-Item -Recurse -Force "$env:USERPROFILE\.codex" }
mkdir "$env:USERPROFILE\.codex"

@"
model_provider = "codyrouter"
model = "gpt-5.3-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"

[model_providers.codyrouter]
name = "codyrouter"
base_url = "https://api.codyrouter.com/"
wire_api = "responses"
requires_openai_auth = true
"@ | Out-File -FilePath "$env:USERPROFILE\.codex\config.toml" -Encoding utf8

@"
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}
"@ | Out-File -FilePath "$env:USERPROFILE\.codex\auth.json" -Encoding utf8
bash
rm -rf ~/.codex && mkdir -p ~/.codex

cat > ~/.codex/config.toml << 'EOF'
model_provider = "codyrouter"
model = "gpt-5.3-codex"
model_reasoning_effort = "high"
disable_response_storage = true
preferred_auth_method = "apikey"

[model_providers.codyrouter]
name = "codyrouter"
base_url = "https://api.codyrouter.com/"
wire_api = "responses"
requires_openai_auth = true
EOF

cat > ~/.codex/auth.json << 'EOF'
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}
EOF

Replace YOUR_API_KEY with an API key copied from the dashboard.

Step 3: Start Using Codex

bash
codex

CodyRouter integration documentation.