TokensClub documentation

Connect Claude Code

Connect Claude Code using a TokensClub API key and an available Claude group over the Anthropic Messages protocol. This guide includes terminal, VS Code and local configuration examples.

On this page

1. Prepare a Claude key

Install official Claude Code and create a TokensClub key with access to a Claude group. The Sonnet and Haiku examples below are in the current catalog; use complete model IDs that your key is allowed to call.

Base URLhttps://tokensclub.top
APIAnthropic Messages
Modelclaude-sonnet-4-6
Haikuclaude-haiku-4-5

Set ANTHROPIC_BASE_URL to the domain only. Claude Code appends /v1/messages; unlike the Codex base URL, do not add /v1 or /messages.

2. Quick terminal setup

Replace the key placeholder on your own computer. Verify the current terminal session before saving a persistent configuration; these environment variables do not replace your saved account login.

macOS / Linux

export ANTHROPIC_BASE_URL="https://tokensclub.top"
export ANTHROPIC_AUTH_TOKEN="YOUR_TOKENSCLUB_API_KEY"
export ANTHROPIC_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
claude

Windows PowerShell

$env:ANTHROPIC_BASE_URL = "https://tokensclub.top"
$env:ANTHROPIC_AUTH_TOKEN = "YOUR_TOKENSCLUB_API_KEY"
$env:ANTHROPIC_MODEL = "claude-sonnet-4-6"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-4-6"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5"
claude

The key must support both the main Sonnet model and the background Haiku model. Check catalog access before choosing Opus, and use full model IDs rather than assuming a latest alias matches an available version.

3. Save local configuration

For persistence, merge env into your user ~/.claude/settings.json, or %USERPROFILE%\.claude\settings.json on Windows. Retain existing fields and use valid JSON without comments or trailing commas. Keep real keys out of shared project settings.

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://tokensclub.top",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_TOKENSCLUB_API_KEY",
    "ANTHROPIC_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5"
  }
}

4. VS Code and desktop

For the official VS Code extension, merge the following into Preferences: Open User Settings (JSON), then restart the extension. Use personal editor settings rather than a shared project file.

{
  "claudeCode.environmentVariables": [
    {
      "name": "ANTHROPIC_BASE_URL",
      "value": "https://tokensclub.top"
    },
    {
      "name": "ANTHROPIC_AUTH_TOKEN",
      "value": "YOUR_TOKENSCLUB_API_KEY"
    },
    {
      "name": "ANTHROPIC_MODEL",
      "value": "claude-sonnet-4-6"
    },
    {
      "name": "ANTHROPIC_DEFAULT_HAIKU_MODEL",
      "value": "claude-haiku-4-5"
    }
  ]
}

Claude Desktop uses separate third-party inference configuration. Terminal exports or settings.json alone do not establish desktop gateway routing. Follow the official desktop gateway instructions; these CLI examples do not configure Claude web or cloud sessions.

5. Verify and troubleshoot

Use /status to verify the base URL and credential source, send a short message, and inspect TokensClub usage logs. Validate streaming, file edits and tool calls for your workflow; a short reply is not a full compatibility guarantee.

For 401, check the key, group and conflicting credential variables. For 404, check the base URL and full model ID. Routine connection troubleshooting should not require deleting login files or disabling client permissions.

Official configuration references

Updated: 2026-10-25 · Features depend on the active platform configuration