Skip to content
BENIBIX Learn

ANTHROPIC_AUTH_TOKEN

AI⌨️ Claude CodeConfiguration

Also known as ANTHROPIC_AUTH_TOKEN environment variable

It sends a token that a gateway can check.

Think of it like

It is like a pass your school gate checks, not the main office.

Example

Emma's company sends all its AI traffic through one gateway. She sets this to her own gateway token. Then the gateway adds the real key.

Why it matters

Staff never hold the real key. The gateway holds it and checks who is asking.

Definition

ANTHROPIC_AUTH_TOKEN sets a token for Claude Code to send in the Authorization header. Claude Code puts Bearer in front of it. It is for a gateway or proxy that checks tokens, not Anthropic keys. When both are set, it wins over the API key.

Example code

bash
export ANTHROPIC_BASE_URL=https://llm.example.com
export ANTHROPIC_AUTH_TOKEN=team-token
Sign in to your company gateway.
ANTHROPIC_AUTH_TOKEN is second, after a cloud provider.

Common mistake

Putting a Console key here. That key goes in the API key one, which sends a different header.

Key takeaways

  1. 1
    Authorization: Bearer. Not X-Api-Key.
  2. 2
    For gateways. That check tokens.
  3. 3
    Second in line. Beats the API key.

Compare