Use GLM-5.3 and Kimi K3.1 Pro in Claude Code: Environment Variables
Claude Code speaks the Anthropic protocol, and TeamoRouter's Anthropic endpoint also serves Zhipu GLM-5.3 and Kimi K3.1 Pro. Neither appears in Claude Code's /model list, so you set them with environment variables: the main model, the Opus and Sonnet tiers, the background model (Claude Code uses it for small jobs such as titles and summaries) and the subagent model. If Claude Code isn't installed yet, start with Install Claude Code CLI and connect it to TeamoRouter.
New accounts start with a $0 balance — top up before your first request. Top up from $5. If a request returns 402 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. Set the environment variables
What each variable takes:
| Variable | For GLM | For Kimi |
|---|---|---|
ANTHROPIC_MODEL (main model) |
glm-5.3 |
kimi-k3.1-pro |
ANTHROPIC_DEFAULT_FABLE_MODEL / ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_SONNET_MODEL |
glm-5.3 |
kimi-k3.1-pro |
ANTHROPIC_DEFAULT_HAIKU_MODEL (background model) |
glm-5.3-flash |
kimi-k3.1-pro |
CLAUDE_CODE_SUBAGENT_MODEL (subagents) |
glm-5.3 |
kimi-k3.1-pro |
macOS / Linux
GLM shown. Paste the block into a terminal; it appends to your shell config (zsh or bash, detected automatically), so new terminals pick it up. Get your API key from the TeamoRouter dashboard:
SHELL_RC="$HOME/.zshrc"; case "$SHELL" in *bash*) SHELL_RC="$HOME/.bashrc";; esac
cat >> "$SHELL_RC" <<'EOF'
export ANTHROPIC_BASE_URL=https://api.teamorouter.com
export ANTHROPIC_AUTH_TOKEN="<your-TeamoRouter-key>"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_MODEL=glm-5.3
export ANTHROPIC_DEFAULT_FABLE_MODEL=glm-5.3
export ANTHROPIC_DEFAULT_OPUS_MODEL=glm-5.3
export ANTHROPIC_DEFAULT_SONNET_MODEL=glm-5.3
export ANTHROPIC_DEFAULT_HAIKU_MODEL=glm-5.3-flash
export CLAUDE_CODE_SUBAGENT_MODEL=glm-5.3
EOF
source "$SHELL_RC"
If you already set these variables with the Claude Code guide, that's fine: for the same variable, the last line in the file wins.
Windows
Run in PowerShell (setx writes user environment variables; open a new terminal afterwards):
setx ANTHROPIC_BASE_URL "https://api.teamorouter.com"
setx ANTHROPIC_AUTH_TOKEN "<your-TeamoRouter-key>"
setx ANTHROPIC_API_KEY ""
setx ANTHROPIC_MODEL "glm-5.3"
setx ANTHROPIC_DEFAULT_FABLE_MODEL "glm-5.3"
setx ANTHROPIC_DEFAULT_OPUS_MODEL "glm-5.3"
setx ANTHROPIC_DEFAULT_SONNET_MODEL "glm-5.3"
setx ANTHROPIC_DEFAULT_HAIKU_MODEL "glm-5.3-flash"
setx CLAUDE_CODE_SUBAGENT_MODEL "glm-5.3"
For Kimi, replace every glm-5.3 and glm-5.3-flash above with kimi-k3.1-pro.
Start and check
If you've signed in to Claude Code with an Anthropic account before, run claude /logout first. Then open a new terminal, run claude and type /status. If the Model line shows glm-5.3, it's working.
2. Try it for one session only
To leave your global setup alone, pass the variables for a single launch (macOS / Linux, with ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN already set):
ANTHROPIC_MODEL=kimi-k3.1-pro ANTHROPIC_DEFAULT_HAIKU_MODEL=kimi-k3.1-pro CLAUDE_CODE_SUBAGENT_MODEL=kimi-k3.1-pro claude
Close the session and the next launch goes back to your usual model.
Troubleshooting
- Still using a Claude model:
ANTHROPIC_API_KEYmust be empty (Claude Code prefers it when set). Open a new terminal after changes; on Windows, reopen PowerShell after setx. Check the current model with/status. - Picking Opus or Sonnet in
/modelswitches back to Claude:ANTHROPIC_DEFAULT_OPUS_MODELorANTHROPIC_DEFAULT_SONNET_MODELisn't set. Add them from the table. - Switching back to Claude: set these lines back to Claude model IDs (see the Claude Code guide), or delete them and open a new terminal.