Skip to main content
Claude Code is Anthropic’s official CLI AI coding assistant that lets you write, debug, and refactor code directly in your terminal.

Prerequisites

Make sure Claude Code CLI is installed:
npm install -g @anthropic-ai/claude-code
Add to your shell config file:
export ANTHROPIC_BASE_URL="https://betarouter.com"
export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"
Apply and start:
source ~/.zshrc
claude

Method 2: Inline at Launch

Useful for temporary use or multi-account switching:
ANTHROPIC_BASE_URL="https://betarouter.com" \
ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx" \
claude

Method 3: Config File

Edit ~/.claude/settings.json:
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://betarouter.com",
    "ANTHROPIC_API_KEY": "sk-xxxxxxxxxxxx"
  }
}

Priority

Launch args > Environment variables > Config file. Higher priority overrides lower priority.
ImportantANTHROPIC_BASE_URL does not need a /v1 suffix — Claude Code appends the path automatically. This differs from OpenAI’s OPENAI_BASE_URL.

Verify Configuration

After starting Claude Code, send a simple question to test:
claude "Hello, please reply in English"
If you receive a normal response, the configuration is successful.