Connect Claude Code CLI to TeamoRouter

This guide is for using Claude Code in a terminal. If you are not comfortable with command-line tools, download the Claude desktop app from the Claude website and follow the CC Switch guide.

1. Install Claude Code from scratch

Claude Code is an AI coding assistant that runs inside your terminal. If Claude Code is already installed, skip to the next section.

Install Claude Code

Install Node.js before installing Claude Code, so the package can download and run correctly.

  • Download and install Node.js 18 or later.

Node.js download page

After installation, you do not need to open Node.js separately.

Git for Windows download page

After installation, you do not need to open Git separately.

After the prerequisites are installed, open your terminal.

On macOS, search for Terminal in Applications and open it.

macOS Terminal app

On Windows 11, press Win + S, search for Terminal, and open it.

On Windows 10, press Win + S, search for Terminal, then open Command Prompt.

Windows terminal app

Copy and run the command below:

plaintext
npm install -g @anthropic-ai/claude-code

After installation, run:

plaintext
claude --version

If a version such as x.x.xxx (Claude Code) appears, Claude Code is installed successfully.

Claude Code installed successfully

Configure environment variables

For Linux and macOS, write the following variables into your shell config file. The script detects zsh or bash automatically. Create your API Key in the TeamoRouter dashboard.

plaintext
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 API Key"
export ANTHROPIC_MODEL=claude-opus-4-7
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-7
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001
export CLAUDE_CODE_SUBAGENT_MODEL=claude-sonnet-4-6
export CLAUDE_CODE_EFFORT_LEVEL=high
EOF
source "$SHELL_RC"

For Windows, run the following commands in PowerShell. They use setx to write user-level environment variables permanently. Reopen the terminal after running them.

plaintext
setx ANTHROPIC_BASE_URL "https://api.teamorouter.com"
setx ANTHROPIC_AUTH_TOKEN "your TeamoRouter API Key"
setx ANTHROPIC_MODEL "claude-opus-4-7"
setx ANTHROPIC_DEFAULT_OPUS_MODEL "claude-opus-4-7"
setx ANTHROPIC_DEFAULT_SONNET_MODEL "claude-sonnet-4-6"
setx ANTHROPIC_DEFAULT_HAIKU_MODEL "claude-haiku-4-5-20251001"
setx CLAUDE_CODE_SUBAGENT_MODEL "claude-sonnet-4-6"
setx CLAUDE_CODE_EFFORT_LEVEL "high"

Run claude

In PowerShell or your terminal, run:

plaintext
claude

Claude Code launch example

2. Claude Code is already installed

If Claude Code is already installed, update the environment variables below. Create your API Key in the TeamoRouter dashboard.

For Linux and macOS:

plaintext
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 API Key"
export ANTHROPIC_MODEL=claude-opus-4-7
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-7
export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-6
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5-20251001
export CLAUDE_CODE_SUBAGENT_MODEL=claude-sonnet-4-6
export CLAUDE_CODE_EFFORT_LEVEL=high
EOF
source "$SHELL_RC"

For Windows PowerShell:

plaintext
setx ANTHROPIC_BASE_URL "https://api.teamorouter.com"
setx ANTHROPIC_AUTH_TOKEN "your TeamoRouter API Key"
setx ANTHROPIC_MODEL "claude-opus-4-7"
setx ANTHROPIC_DEFAULT_OPUS_MODEL "claude-opus-4-7"
setx ANTHROPIC_DEFAULT_SONNET_MODEL "claude-sonnet-4-6"
setx ANTHROPIC_DEFAULT_HAIKU_MODEL "claude-haiku-4-5-20251001"
setx CLAUDE_CODE_SUBAGENT_MODEL "claude-sonnet-4-6"
setx CLAUDE_CODE_EFFORT_LEVEL "high"

After configuration, reopen your terminal and run:

plaintext
claude
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 Claude Code CLI to TeamoRouter · Docs