Quick answer
When configuring a third-party API in Claude Code, first confirm that the endpoint is Anthropic-compatible. In this documentation, Claude Code useshttps://www.bettertoken.ai. Do not add /v1.
The API Key authenticates the request. The Base URL tells Claude Code where to send model requests. Both must belong to the same provider and protocol.
With the Claude Key group, Claude Code usually needs ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. With the GPT Key group, you also need Claude Code model mappings from the setup guide.
When this matters
- You want Claude Code to use a custom API gateway
- You have an API Key but are unsure which Base URL to use
- Claude Code reports an authentication or endpoint error
- You are choosing between
https://www.bettertoken.aiandhttps://www.bettertoken.ai/v1 - You need to understand Claude and GPT Key groups
Key concepts
Recommended setup
Choose the setup path by API Key group. Claude Key group:https://www.bettertoken.ai/v1.
Common mistakes
- Adding
/v1to the Claude Code Base URL. - Changing the API Key but leaving requests pointed at the default endpoint.
- Treating a GPT Key group model ID as a Claude Key group model.
- Putting an OpenAI-compatible endpoint into Claude Code’s Anthropic-compatible fields.
- Defining old environment variables in a shell profile that override the new config.
About BetterToken
BetterToken provides two endpoint types: the Anthropic-compatiblehttps://www.bettertoken.ai for Claude Code and the OpenAI-compatible https://www.bettertoken.ai/v1 for Codex and external tools.
This lets you manage API Keys, balance, and usage history in one dashboard, but it does not change Claude Code’s requirement for Anthropic-compatible request formatting.
Related docs
- Claude Code setup guide
- Does Claude Code use a Claude.ai account or an API Key?
- OpenAI-compatible API vs Anthropic-compatible API
- Why Claude Code uses so many tokens and how to reduce cost