Use GLM-5.3 and Kimi K3.1 Pro in Codex: config.toml Setup

Codex uses GPT models by default. Once it's connected to TeamoRouter, the same API key also calls Zhipu GLM-5.3 and Kimi K3.1 Pro: change model in ~/.codex/config.toml to the model ID. Codex CLI and Codex Desktop read the same file. If Codex isn't installed yet, start with Install Codex CLI and connect it to TeamoRouter.

New accounts start with a $0 balance — top up before your first request. Top up from $5. If Codex shows 400 Bad Request with "wallet balance is insufficient", your balance is empty — your base URL and key are fine. Top up and retry.

Models you can use

Model Model ID Context
GLM-5.3 glm-5.3 1M tokens
GLM-5.3-Flash glm-5.3-flash 1M tokens
Kimi K3.1 Pro kimi-k3.1-pro 1M tokens
Kimi K3 kimi-k3 1M tokens

Prices are on each model page.

1. Write the config

If you've already connected Codex to TeamoRouter with the Codex guide, just change the model = line to a model ID from the table. Otherwise paste the whole block below.

macOS / Linux

Open a terminal, paste the block and press Enter (GLM-5.3 shown; for Kimi, replace glm-5.3 with kimi-k3.1-pro):

plaintext
mkdir -p ~/.codex && cat > ~/.codex/config.toml <<'EOF'
model_provider = "teamorouter"
model = "glm-5.3"
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 = "glm-5.3"
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

These commands overwrite your existing config.toml. If it has other settings you want to keep, edit the model line by hand instead.

Set the API key

Replace <your-TeamoRouter-key> with a key from the TeamoRouter dashboard. Skip this if OPENAI_API_KEY is already set.

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 (close this PowerShell window and open a new one afterwards):

plaintext
[Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "<your-TeamoRouter-key>", "User")

Now run codex in the terminal. It uses GLM-5.3.

2. Switch models

  • Use another model for one session: codex -m kimi-k3.1-pro
  • Switch for good: change the model line in config.toml.
  • Flip between a few models: add profiles at the end of config.toml and pick one with --profile:
plaintext
[profiles.glm]
model_provider = "teamorouter"
model = "glm-5.3"

[profiles.kimi]
model_provider = "teamorouter"
model = "kimi-k3.1-pro"
plaintext
codex --profile kimi

3. Codex Desktop

Codex Desktop reads the same ~/.codex/config.toml as the CLI. After editing it, quit Codex Desktop completely and reopen it. GLM and Kimi aren't in the desktop model menu; the model in config.toml is what's used. Picking another model from the menu switches to that model.

Troubleshooting

  • An error about reasoning effort: GLM accepts only efforts such as low and high. Keep model_reasoning_effort at "high" or set it to "low"; don't use "medium" or "minimal".
  • The model writes commands as text instead of running them: you're probably using a custom model catalog (model_catalog_json) whose GLM / Kimi entry was copied from a GPT entry, carrying use_responses_lite over. Set use_responses_lite to false in that entry, or delete the entry.
  • Requests still go to OpenAI: check that the first line of config.toml is model_provider = "teamorouter", and that the provider isn't named openai.
Ready? Three steps to startLog in to the console · top up · create an API key
DiscordGet community help instantly