โก Claude Code Setup
Claude Code is Anthropic's official CLI coding tool for code generation, editing, debugging, and project management. By routing through this platform, you can use a unified API key and billing system to access Claude models. Official docs
๐ Prerequisites
- Node.js 18+
- An API key from this platform (create one in API Key Management)
- Ensure the token has access to Claude models
๐ฅ Installation
| Platform | Recommended | Alternative |
|---|---|---|
| macOS | brew install --cask claude-code | curl -fsSL https://claude.ai/install.sh | bash |
| Linux | curl -fsSL https://claude.ai/install.sh | bash | โ |
| Windows | irm https://claude.ai/install.ps1 | iex | CMD: curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd |
Verify: claude -v. npm install is not recommended (versions may lag behind).
โก Skip Onboarding (Required for First Install)
When using a relay, Claude Code's first launch attempts to connect to the official API for onboarding, showing this error:
Welcome to Claude Code
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUESTAfter installation but before first launch, add the following to ~/.claude.json to skip onboarding:
{
"installMethod": "unknown",
"autoUpdates": true,
"hasCompletedOnboarding": true
}โ ๏ธ JSON Format
If the file already has content, add a comma after the previous field before adding "hasCompletedOnboarding": true. Invalid JSON will prevent Claude Code from starting.
๐ง Environment Variables
Replace sk-xxx with your API Key.
Bash / Zsh (macOS / Linux)
export ANTHROPIC_AUTH_TOKEN="sk-xxx"
export ANTHROPIC_BASE_URL="https://api.tokenreply.com"
# Add to shell config for persistence:
# echo 'export ANTHROPIC_AUTH_TOKEN="sk-xxx"' >> ~/.zshrc
# echo 'export ANTHROPIC_BASE_URL="https://api.tokenreply.com"' >> ~/.zshrcPowerShell (Windows)
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-xxx", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.tokenreply.com", "User")CMD (Windows)
setx ANTHROPIC_AUTH_TOKEN "sk-xxx"
setx ANTHROPIC_BASE_URL "https://api.tokenreply.com"Restart the terminal after setting variables, then run claude.
๐ก Tip
Note the variable names: ANTHROPIC_BASE_URL (without /v1 suffix) and ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY).
โ Verify Configuration
After restarting the terminal, test the connection:
claude "hello"If configured correctly, Claude Code will respond.
โ Troubleshooting
claude command not found
- Check if PATH includes the installation directory
- Restart the terminal
- Try reinstalling
Connection failed / ERR_BAD_REQUEST
- Verify
ANTHROPIC_BASE_URLis set tohttps://api.tokenreply.com(without /v1) - Verify the API key is valid and the account has in-plan usage available; once in-plan usage runs out, paid models fall through to the wallet balance, so make sure it is sufficient
- Verify
hasCompletedOnboarding: trueis added to~/.claude.json
Model not available
- Confirm the token's group has access to Claude models
- Check if Claude models are available on the Models page
๐ Related Links
- API Key Management: create and manage API keys
- Base URL & Auth: endpoint and authentication configuration
- FAQ & Troubleshooting: more troubleshooting guidance
