Connect Codex CLI to TeamoRouter

Codex CLI is OpenAI's terminal-based AI coding assistant. If Codex is already installed, skip to the second section.

1. Install Codex from scratch

Install Codex

  • Install Node.js 22 or later, or use Homebrew or the official installer.

  • macOS users can also install Codex with Homebrew: brew install codex.
  • In your terminal, run:
plaintext
npm install -g @openai/codex
  • After installation, check the version:
plaintext
codex --version

Configure the provider

macOS / Linux

Open a terminal, paste the full block below, and press Enter:

plaintext
mkdir -p ~/.codex && cat > ~/.codex/config.toml <<'EOF'
model_provider = "teamorouter"
model = "gpt-5.4"
model_reasoning_effort = "high"
[model_providers.teamorouter]
name = "TeamoRouter"
base_url = "https://api.teamorouter.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
EOF
Windows

Open PowerShell and run:

plaintext
New-Item -ItemType Directory -Force -Path "$HOME\.codex" | Out-Null
@'
model_provider = "teamorouter"
model = "gpt-5.4"
model_reasoning_effort = "high"

[model_providers.teamorouter]
name = "TeamoRouter"
base_url = "https://api.teamorouter.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
'@ | Set-Content -Path "$HOME\.codex\config.toml" -Encoding UTF8

Set the API Key

Replace <your-TeamoRouter-key> with the API Key you created in the TeamoRouter dashboard.

macOS
plaintext
echo 'export OPENAI_API_KEY="<your-TeamoRouter-key>"' >> ~/.zshrc
source ~/.zshrc
Linux
plaintext
echo 'export OPENAI_API_KEY="<your-TeamoRouter-key>"' >> ~/.bashrc
source ~/.bashrc
Windows
plaintext
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "<your-TeamoRouter-key>", "User")

Windows users: after running the command above, close the current PowerShell window and open a new one.

After all three steps, run codex in the terminal. It will use TeamoRouter.

2. Codex is already installed

If Codex is already installed, update the provider and API Key configuration. Create your API Key in the TeamoRouter dashboard.

Configure the provider

macOS / Linux
plaintext
mkdir -p ~/.codex && cat > ~/.codex/config.toml <<'EOF'
model_provider = "teamorouter"
model = "gpt-5.4"
model_reasoning_effort = "high"
[model_providers.teamorouter]
name = "TeamoRouter"
base_url = "https://api.teamorouter.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
EOF
Windows
plaintext
New-Item -ItemType Directory -Force -Path "$HOME\.codex" | Out-Null
@'
model_provider = "teamorouter"
model = "gpt-5.4"
model_reasoning_effort = "high"

[model_providers.teamorouter]
name = "TeamoRouter"
base_url = "https://api.teamorouter.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
'@ | Set-Content -Path "$HOME\.codex\config.toml" -Encoding UTF8

Set the API Key

macOS
plaintext
echo 'export OPENAI_API_KEY="<your-TeamoRouter-key>"' >> ~/.zshrc
source ~/.zshrc
Linux
plaintext
echo 'export OPENAI_API_KEY="<your-TeamoRouter-key>"' >> ~/.bashrc
source ~/.bashrc
Windows
plaintext
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "<your-TeamoRouter-key>", "User")

Windows users: after running the command above, close the current PowerShell window and open a new one.

After both steps, run codex in the terminal. It will use TeamoRouter.

Ready? Three steps to startLog in to the console · top up · create an API key
Scan to join the WeChat support group
Need help?Scan to join the support group
Connect Codex CLI to TeamoRouter · Docs