Claude Code with TokenPass
Use TokenPass as an Anthropic-compatible provider for Claude Code.
Install Claude Code
Use an installation method published by Anthropic:
bash
npm install -g @anthropic-ai/claude-codeVerify the installation:
bash
claude --versionConfigure settings.json
Add the TokenPass environment values to Claude Code settings:
json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "<TOKENPASS_API_KEY>",
"ANTHROPIC_BASE_URL": "https://tokenpass.cloud",
"ANTHROPIC_MODEL": "claude-sonnet-4-6"
}
}Claude Code appends the Messages API path itself, so its provider base URL does not include /v1 in this configuration. Direct TokenPass API calls continue to use https://tokenpass.cloud/v1.
Environment variables
Linux and macOS:
bash
export ANTHROPIC_AUTH_TOKEN="<TOKENPASS_API_KEY>"
export ANTHROPIC_BASE_URL="https://tokenpass.cloud"
export ANTHROPIC_MODEL="claude-sonnet-4-6"PowerShell:
powershell
$env:ANTHROPIC_AUTH_TOKEN = "<TOKENPASS_API_KEY>"
$env:ANTHROPIC_BASE_URL = "https://tokenpass.cloud"
$env:ANTHROPIC_MODEL = "claude-sonnet-4-6"Verify
Run claude, send a short request, and use /status to inspect the active model. Use only model IDs listed as Claude Code compatible in the TokenPass model catalog.