Tool IntegrationsClaude Code

Claude Code

Install

Claude Code officially recommends the native installer (a standalone binary, no Node.js runtime required).

The methods below are the ones listed in the official docs; for anything else, defer to the official install docs.

System requirements: macOS 13.0+, Windows 10 1809+, Ubuntu 20.04+ / Debian 10+ / Alpine Linux 3.19+, 4 GB+ RAM, x64 or ARM64 processor.

Native installer (recommended)

macOS / Linux / WSL:

curl -fsSL https://claude.ai/install.sh | bash

Windows (PowerShell):

irm https://claude.ai/install.ps1 | iex

Homebrew (macOS)

brew install --cask claude-code

WinGet (Windows)

winget install Anthropic.ClaudeCode

npm fallback (requires Node.js 18+)

npm install -g @anthropic-ai/claude-code

After install, verify with claude --version.

Connect TokenBay

Claude Code switches to a third-party gateway through two env vars:

  • ANTHROPIC_BASE_URL points at TokenBay
  • ANTHROPIC_AUTH_TOKEN is sent as the Bearer credential

Claude Code appends /v1/messages to the base URL itself — don’t include any path in ANTHROPIC_BASE_URL.

1. Get an API key

Log in to the TokenBay consoleAPI keysCreate key.

Once the key is created, copy the full string starting with sk-.

The plain text shows only once and can’t be viewed again after you leave the page.

Console create API key

2. Update the configuration

Claude Code supports two approaches — environment variables and a config file. Pick whichever you prefer.

Environment variables

VariableValue
ANTHROPIC_BASE_URLhttps://api.tokenbay.com
ANTHROPIC_AUTH_TOKENYour TokenBay API key (sk-...)
ANTHROPIC_API_KEYExplicitly set to empty ""

Critical: you must explicitly set ANTHROPIC_API_KEY to an empty string. Once Claude Code detects this variable is non-empty (for example, a leftover official key), it will prefer using it to connect to Anthropic directly and ignore ANTHROPIC_AUTH_TOKEN, showing up as mysterious auth failures or “model not found” errors.

macOS / Linux (zsh or bash)

Append the three lines below to ~/.zshrc or ~/.bashrc, then run source ~/.zshrc to apply them:

export ANTHROPIC_BASE_URL="https://api.tokenbay.com"
export ANTHROPIC_AUTH_TOKEN="sk-XXXXXXX"
export ANTHROPIC_API_KEY=""

Windows (PowerShell, persistent user env)

[Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL','https://api.tokenbay.com','User')
[Environment]::SetEnvironmentVariable('ANTHROPIC_AUTH_TOKEN','sk-XXXXXXX','User')
[Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY','','User')

Windows (CMD)

setx ANTHROPIC_BASE_URL "https://api.tokenbay.com"
setx ANTHROPIC_AUTH_TOKEN "sk-XXXXXXX"
setx ANTHROPIC_API_KEY ""

Both the PowerShell and CMD forms persist the env vars at user scope — open a new terminal window before they take effect.

Config file

If you’d rather not pollute the global env, use $HOME/.claude/settings.json (user-wide) or a project-local .claude/settings.json (project-wide, higher priority) instead:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenbay.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
    "ANTHROPIC_API_KEY": ""
  }
}

3. Model configuration

Recommended models:

Use caseModel ID
Everyday codingclaude-sonnet-4.6
Deep reasoning / long contextclaude-opus-4.8
Lightweightclaude-haiku-4.5

See the full list at Models.

Note: in model names, the version number only accepts the dotted form (e.g. claude-sonnet-4.6) — don’t write it with hyphens (claude-sonnet-4-6).

Model configuration can be written into the env vars alongside the credentials above, for example:

export ANTHROPIC_BASE_URL="https://api.tokenbay.com"
export ANTHROPIC_AUTH_TOKEN="sk-XXXXXXX"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4.8"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4.6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4.5"
export ANTHROPIC_MODEL="sonnet"

Or merge them into settings.json:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenbay.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
    "ANTHROPIC_API_KEY": "",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4.8",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4.6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5",
    "ANTHROPIC_MODEL": "sonnet"
  }
}

4. Advanced configuration

Deep reasoning or long-context tasks take a while, and the default timeout may cut requests off.

API_TIMEOUT_MS raises the timeout ceiling for a single request (in milliseconds — for example 600000 is about 10 minutes).

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tokenbay.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4.8",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4.6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4.5",
    "ANTHROPIC_MODEL": "sonnet",
    "API_TIMEOUT_MS": "600000"
  }
}

5. Clear the official login cache

If you’ve previously logged in to Claude Code with an Anthropic account, the cached login state will conflict with your gateway credentials. On startup you may see an auth-conflict warning, which shows up as mysterious “model not found” errors.

Before switching to TokenBay, log out once inside a session:

/logout

Then fully quit and restart claude so it picks up the new env vars. Users who have never logged in with an Anthropic account can skip this step.

Note: /logout only clears the cached login state — it does not clear a leftover ANTHROPIC_API_KEY in your shell. If that variable still points at an old official key, set it to empty per section 2 and reopen the terminal.

6. Verify the connection

Once inside a session, run /status to confirm you’re going through TokenBay rather than the official endpoint:

/status

Auth token should read ANTHROPIC_AUTH_TOKEN, and Anthropic base URL should read https://api.tokenbay.com.

7. Troubleshooting

SymptomCause and fix
Model not found / auth failureUsually a credential conflict. First confirm ANTHROPIC_API_KEY="" is set to empty in your shell and reopen the terminal; then /logout inside the session and restart claude.
Still getting auth errors after emptying the keyA cached login state remains. Run /logout and restart claude. Use /status to double-check the base URL and auth source.
Env-var changes don’t take effectEnv vars only get read in a new terminal; settings.json changes require restarting claude.
Context limit exceededSplit the task or start a new session (/clear).