Skip to main content
Claude models can connect directly through terminal variables or a settings file. Kimi and GLM use the same Base URL with explicit model mappings. Start with the Claude Code custom API endpoint, API Key, and Base URL guide. GPT requires advanced setup.

Key settings

Prerequisites

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.
After it finishes, inspect ~/.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:
The Claude provider needs only these four variables. Do not add ANTHROPIC_MODEL or ANTHROPIC_DEFAULT_*_MODEL.

Configure a Kimi or GLM provider

Kimi and GLM require model mappings in the same settings.json. Replace each YOUR_MODEL_ID with a Model ID from the Setup dialog or model plaza:
The three mappings can use one Model ID or different models from the same provider. Do not put a GPT Model ID here; use the advanced setup at the end of this page.

Configure the Claude Code VS Code extension

The extension uses VS Code settings.json. Add a separate claudeCode.environmentVariables configuration:
Run Developer: Reload Window, or fully restart VS Code.

Verify the connection

Start Claude Code in your project:
Send a short message. A normal response without 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_MODEL or ANTHROPIC_DEFAULT_*_MODEL.
  • Kimi or GLM provider: change ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_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.
  • 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.
To use GPT in Claude Code, configure it through CC Switch with BetterToken. Enter the API Key, Base URL, and Model Mapping in the Claude Code tab, then enable the proxy.

Technical details

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.