A Claude Code proxy is an LLM gateway your organization runs between Claude Code and the model provider. You point Claude Code at it with a base URL and gateway-issued credentials, and it authenticates to the gateway instead of your personal claude.ai login.
The short answer: set ANTHROPIC_BASE_URL to the gateway address, set ANTHROPIC_AUTH_TOKEN (bearer token) or ANTHROPIC_API_KEY (x-api-key) depending on what the gateway expects, then run /status and send a test prompt to confirm the connection.
What an LLM gateway does
An LLM gateway is a proxy between Claude Code and the model provider (Claude Code docs). When your organization uses one, Claude Code authenticates with credentials the organization issues, not your personal login. Teams run gateways to centralize billing, enforce policy, log traffic, or route across providers.
This is the same pattern as bring-your-own-key routing: the client talks to one endpoint, and the endpoint decides which provider and model actually serve the request.
Set the base URL and auth
You need two things from your gateway team: the base URL, and the credential (a key or token string, or a command that fetches one). Which auth variable you set depends on how the gateway authenticates:
| Variable | Use when the gateway says |
|---|---|
ANTHROPIC_AUTH_TOKEN | "bearer token" or "Authorization header" |
ANTHROPIC_API_KEY | "API key" or "x-api-key" |
apiKeyHelper | credentials rotate or come from a vault |
If you were not told which type, start with ANTHROPIC_AUTH_TOKEN (docs). Set them in your shell for one terminal session, or in a Claude Code settings file to persist:
export ANTHROPIC_BASE_URL="https://gateway.example.com"
export ANTHROPIC_AUTH_TOKEN="your-gateway-token"
claudeVerify the connection
Run /status and open the status tab. Two lines confirm the gateway is active:
- Anthropic base URL — appears only when a gateway address is set. If it is missing, Claude Code is not pointed at a gateway.
- Auth token / API key — a line naming
ANTHROPIC_AUTH_TOKEN,ANTHROPIC_API_KEY, orapiKeyHelperconfirms gateway auth. A login method naming your claude.ai account means credentials were not distributed.
Close /status and send any prompt. A normal response with no error confirms the gateway connection works. If both lines look right but messages fail, the problem is downstream — check the gateway's own logs and the troubleshooting table in the docs.
Check whether your admin already configured it
Admins can distribute the gateway address and credentials through managed settings, device management, or apiKeyHelper, so Claude Code picks them up at startup with no setup from you. If claude opens a session instead of the login screen, run /status before configuring anything yourself — the gateway may already be wired.
Common gateway errors
- Login screen instead of a session: gateway credentials were not distributed; set the base URL and auth yourself.
- 401 / auth failures: you likely picked the wrong variable. A gateway expecting
x-api-keyrejects a bearer token; switchANTHROPIC_AUTH_TOKEN↔ANTHROPIC_API_KEY. - Base URL line missing:
ANTHROPIC_BASE_URLis not set in the environment Claude Code actually reads. - Requests fail with both lines correct: the gateway is reachable but the upstream provider call fails — inspect the gateway, not the client.
Some gateways also need custom headers, model discovery, or provider-format base URLs; set those only when your gateway team names them or your network restricts outbound traffic.
Where this fits with a routing hub
A gateway is one way to centralize model access; a routing hub is another. Octomind's hub bills across providers at the API rate with no per-token markup, so the same base-URL-and-key pattern lets one client reach many models. If you are choosing between a self-run gateway and a hosted hub, the deciding factors are who owns the credentials, who logs traffic, and whether you want provider choice without running infrastructure.



