# ANTHROPIC_AUTH_TOKEN

> It sends a token that a gateway can check.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** ANTHROPIC_AUTH_TOKEN environment variable

## Think of it like

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

## 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

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.

## Example code

```bash
export ANTHROPIC_BASE_URL=https://llm.example.com
export ANTHROPIC_AUTH_TOKEN=team-token
```

Sign in to your company gateway.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [ANTHROPIC_API_KEY](https://learn.benibix.com/term/ai/anthropic-api-key-variable)
- [Bearer Token](https://learn.benibix.com/term/development/bearer-token)
- [LLM Gateway](https://learn.benibix.com/term/development/llm-gateway)
- [ANTHROPIC_BASE_URL](https://learn.benibix.com/term/ai/anthropic-base-url-variable)

## Told apart from

- [ANTHROPIC_API_KEY vs ANTHROPIC_AUTH_TOKEN](https://learn.benibix.com/compare/anthropic-api-key-variable-vs-anthropic-auth-token-variable): People think ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are two names for one key. They send different headers to different checkers. The API key is a Console key. It goes out as X-Api-Key, and Anthropic checks it. The token goes out as a Bearer header, and a gateway checks it. When both are set, the token wins. Use the key to reach Anthropic, and the token to reach your gateway.

![When many sign-ins are set, Claude Code uses the first one it finds in this list.](https://learn.benibix.com/diagrams/env-auth-order.svg)

---

Source: https://learn.benibix.com/term/ai/anthropic-auth-token-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
