Claude Code is using an API key instead of your Max plan? Here's how to fix it
Why Claude Code bills an API key or another provider instead of your Claude Max subscription — environment variables and settings.json env blocks — and how to find and remove them.
You pay for Claude Max, but Claude Code charges an API key, hits another provider, or shows usage you don’t recognise. The login is almost never the problem. Something in your setup is overriding it, and Claude Code obeys that override without telling you.
How to tell
- In Claude Code, run
/status: it shows how you are signed in and which endpoint is in use. - In CC Cadence, the status line under the chat shows the auth source of every turn. On the Max plan it says Max subscription. Otherwise you get a warning: “This turn of the Claude profile authenticated via …, not the Max subscription.”
Cause 1: an API key or endpoint in your shell environment
If ANTHROPIC_API_KEY is set, Claude Code can use it instead of your subscription login — in
non-interactive runs (claude -p) it always wins. ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN send every request to another
provider. Check what your shell exports:
env | grep -E '^(ANTHROPIC_|CLAUDE_CODE_)'
If something shows up, find where it is set (~/.zshrc, ~/.bashrc, ~/.profile, a .env loader, your
terminal’s settings) and remove it, then open a new terminal.
Cause 2: an env block in a Claude settings file
This one catches the most people. Guides for GLM, DeepSeek, MiniMax and other coding plans tell you to add
something like this to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://…",
"ANTHROPIC_AUTH_TOKEN": "…"
}
}
An env block in a settings file outranks the process environment. Every Claude Code session, in every
project, now goes to that provider, and your Max login is never used. Check these files:
~/.claude/settings.json— your user settings, used everywhere.claude/settings.jsonin the project — shared with the repository.claude/settings.local.jsonin the project — your local overrides
Delete the ANTHROPIC_* keys (or the whole env block if that’s all it holds), save, and start Claude Code
again. /status should now show your subscription.
Cause 3: signed in with the wrong account
If nothing overrides the login, the login itself may be on a Console (API) account. Run claude, type
/login, and sign in with the Claude account that has the Max subscription.
Keep both without the override
The usual reason for that env block is wanting a second, cheaper model. You don’t need to give up your
Max login for it: CC Cadence strips ANTHROPIC_* and CLAUDE_CODE_* variables from the environment before
it starts claude, keeps each provider as a separate profile with its key in the system keychain, and
switches between them with one click. CC Cadence: Doctor (command palette) lists any settings-file
env keys it can’t strip, so you know exactly what to delete.
See How to use your Claude Max plan and another coding plan in one VS Code window.