Key settings
Prerequisites
- Install the latest Claude Code
- Install Node.js
- Create and copy a BetterToken API Key
Install
Command-line setup
The BetterToken Automatic setup script writes the Claude Code provider configuration. It requires Node.js and prompts for the API Key when one is not passed as an argument.- macOS / Linux
- Windows
~/.claude/settings.json (or %USERPROFILE%\.claude\settings.json on Windows) and fully restart Claude Code. Use the manual setup below when you want to control each field yourself.
Manual setup
Configure the Claude provider
Claude Code CLI reads:
Add:
ANTHROPIC_MODEL or ANTHROPIC_DEFAULT_*_MODEL.
Configure a Kimi or GLM provider
Kimi and GLM require model mappings in the samesettings.json. Replace each YOUR_MODEL_ID with a Model ID from the Setup dialog or model plaza:
Configure the Claude Code VS Code extension
The extension uses VS Codesettings.json. Add a separate claudeCode.environmentVariables configuration:
Verify the connection
Start Claude Code in your project:401, connection, or model errors confirms the setup. Fully restart Claude Code after changing the file.
Switch models
- Claude provider: let Claude Code manage model selection. Do not add
ANTHROPIC_MODELorANTHROPIC_DEFAULT_*_MODEL. - Kimi or GLM provider: change
ANTHROPIC_DEFAULT_HAIKU_MODEL,ANTHROPIC_DEFAULT_SONNET_MODEL, andANTHROPIC_DEFAULT_OPUS_MODEL, then fully restart Claude Code. - GPT provider: follow the advanced setup below to switch models.
Common errors
Advanced setup
Supported providers
Statuses apply to the BetterToken setup documented on this page.
What the setup methods mean
What the setup methods mean
- Advanced setup: install CC Switch and use a local proxy, protocol conversion, or model mapping.
- Manual setup: enter the API Key, Base URL, and Model.
- Command-line + manual setup: use a generated command or follow the complete manual steps.
Related FAQ
- What is Claude Code and how does it work?
- Does Claude Code use a Claude.ai account or an API Key?
- Claude Code custom API endpoint: API Key and Base URL
- How to connect Kimi K3 to Claude Code
- OpenAI-compatible API vs Anthropic-compatible API
- What is CLAUDE.md in Claude Code?
- Why Claude Code uses so many tokens and how to reduce cost
- Claude Code vs Cursor for local development
- Claude Code vs Codex CLI
- How to switch Sonnet and Opus in Claude Code
- Claude Code permissions and hooks
- MCP vs API Key and Base URL
Technical details
Protocol and endpoint
Protocol and endpoint
Claude Code uses Anthropic Messages. Set
ANTHROPIC_BASE_URL to https://bettertoken.ai; the client appends /v1/messages, so do not add /v1 to the Base URL.
