Skip to main content

Claude Code setup

Claude Code is Anthropic’s coding tool for the terminal. Connect it to TokenReply to use Claude models with your TokenReply key and balance. Official documentation

Before you start

  • Node.js 18+
  • A TokenReply API key, created in API key management
  • Claude models available on that key

Installation

PlatformRecommendedAlternative
macOSbrew install --cask claude-codecurl -fsSL https://claude.ai/install.sh | bash
Linuxcurl -fsSL https://claude.ai/install.sh | bashNone
Windowsirm https://claude.ai/install.ps1 | iexCMD: curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Check that it installed with claude -v.

First launch

On first launch, Claude Code can try to run Anthropic’s own onboarding and stop with this error:

Welcome to Claude Code
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUEST

To skip it, add these fields to ~/.claude.json after installing and before the first launch:

{
  "installMethod": "unknown",
  "autoUpdates": true,
  "hasCompletedOnboarding": true
}

Keep the JSON valid

If the file already has fields, put a comma between the last one and "hasCompletedOnboarding": true. Claude Code won’t start if the JSON is broken.

Set 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"

Then run claude in the same terminal (on Windows, open a new one).

Use these variable names

Leave /v1 off ANTHROPIC_BASE_URL, and put your key in ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.

Test the connection

In the same terminal (a new one on Windows), run:

claude "hello"

If Claude Code replies, you’re connected.

Troubleshooting

claude command not found

  • Check that the install folder is on your PATH
  • Restart the terminal
  • Reinstall

Connection failed / ERR_BAD_REQUEST

  • Check that ANTHROPIC_BASE_URL is https://api.tokenreply.com, without /v1
  • Check that the key works and you have usage allowance or wallet balance left
  • Check that hasCompletedOnboarding: true is in ~/.claude.json

Model not available

  • Check that your key’s Channel setting includes Claude models
  • See which Claude models are listed on the Models page

Related guides