Claude Code keeps asking to log in to Anthropic
Claude Code insists on signing in to Anthropic even though your key is configured. One environment variable is to blame.
2 min · 11 September 2026 · claude-code · errors · setup
The symptom is recognisable: your gateway key is set, the base URL is replaced, and Claude Code still opens the Anthropic sign-in flow on startup. Or it silently keeps using the official API, and you find out from the invoice.
The cause
Claude Code distinguishes between two forms of authentication.
ANTHROPIC_API_KEY is an Anthropic key. Seeing it, the client assumes you are talking to Anthropic directly and enables the matching logic: subscription checks, sign-in prompts, calls to their authorisation endpoints.
ANTHROPIC_AUTH_TOKEN is an opaque token the client simply forwards in an Authorization: Bearer header. It triggers no extra logic. That is what you want when working through a third-party gateway.
By putting a gateway key into ANTHROPIC_API_KEY, you are telling the client "this is an Anthropic key", and it behaves accordingly.
The correct configuration
In ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.zukko.pro",
"ANTHROPIC_AUTH_TOKEN": "fetch_your_key",
"DISABLE_TELEMETRY": "1"
}
}Two details trip people up most often.
The base URL takes no /v1 suffix. Claude Code appends the path itself, so a URL ending in /v1 becomes /v1/v1/messages and returns a 404 whose wording gives no hint about the cause.
ANTHROPIC_API_KEY must be absent entirely — not empty, absent. Some client versions read an empty value as "a key is set but wrong".
Verifying
env | grep ANTHROPICThe output should contain only ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. If ANTHROPIC_API_KEY appears, find where it is exported and remove it. Environment variables override the settings file, so editing settings.json while an export is live changes nothing.
Restart Claude Code completely afterwards — values are read at startup.
Confirming traffic goes through the gateway
Make one request and check the usage history in your dashboard. If an event appears, traffic is flowing through the gateway. If no event appears but you got an answer, you are still talking to Anthropic directly and paying them.
zukko
Pay 25×
less
for Claude Code & ChatGPT
One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.