Skip to main content

โšก 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

PlatformRecommendedAlternative
macOSbrew install --cask claude-codecurl -fsSL https://claude.ai/install.sh | bash
Linuxcurl -fsSL https://claude.ai/install.sh | bashโ€”
Windowsirm https://claude.ai/install.ps1 | iexCMD: 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_REQUEST

After 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"' >> ~/.zshrc

PowerShell (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_URL is set to https://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: true is 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