Claude Code CLI Setup Guide
Configure Claude Code CLI to use Router One as a proxy for unified routing, cost controls, and full observability.
Before you start, create your API Key on the Dashboard API Keys page (format:
sk-xxx).1
Install Node.js via Homebrew
Claude Code CLI requires Node.js 18 or later.
bash
brew install nodebash
node --version2
Install Claude Code CLI globally
bash
npm install -g @anthropic-ai/claude-code3
Configure environment variables
Point Claude Code at Router One as its API endpoint.
If you previously used the official Claude CLI, clear the old config first to avoid conflicts:
rm -rf ~/.claudeTemporary (current terminal session only):
bash
export ANTHROPIC_BASE_URL=https://api.router.one
export ANTHROPIC_API_KEY=sk-your-api-key
export ANTHROPIC_AUTH_TOKEN=sk-your-api-keyPermanent (write to shell config):
bash
echo 'export ANTHROPIC_BASE_URL=https://api.router.one' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY=sk-your-api-key' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN=sk-your-api-key' >> ~/.zshrc
source ~/.zshrcANTHROPIC_AUTH_TOKEN is used for Claude Code authentication — set it to the same value as ANTHROPIC_API_KEY.4
Launch Claude Code
Run this to start the CLI:
bash
claude