ANTHROPIC_BASE_URL
A Claude Code environment variable, read out of the shipped bundle. It has been in the build since v2.1.138, including the newest one read.
What it is
Override the API endpoint to route requests through a proxy or gateway. When set to a non-first-party host, [MCP tool search](/docs/en/mcp#scale-with-mcp-tool-search) is disabled by default. Set ENABLE_TOOL_SEARCH=true if your proxy forwards tool_reference blocks. As of v2.1.196, [Remote Control](/docs/en/remote-control#requirements) is disabled when this points at a host other than api.anthropic.com, matching its behavior on Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry
Anthropic's own wording. Read off Environment variables, captured 2026-08-28.
Presence across releases
| Releases | Reading | Declared type | Default |
|---|---|---|---|
| 2.1.245 – 2.1.250 5 releases | never mined | — | — |
| 2.1.160 – 2.1.243 75 releases | in the build | str | — |
| 2.1.138 – 2.1.159 20 releases | in the build | — | — |
A row reading never mined is a release with no archived bundle behind it. Nothing was read out of it, so nothing here says whether the name was in it. A declared type or a default is only ever what that release's own bundle stated.
Changelog entries naming it
-
v2.1.248Gateway model discovery explains why it skipped, and can use apiKeyHelper
Gateway model discovery can authenticate with apiKeyHelper and logs why it skipped.
named in this entry
-
v2.1.242Gateway credentials reworked with a TLS pin store
Gateway credential handling reuses pinned entries and gives clearer errors for bad base URLs.
named in this entry
-
v2.1.232Tool search says once why it turned itself off
Tool search logs why it disabled itself and refuses entirely against a non-Anthropic base URL.
named in this entry
-
v2.1.232Clearer explanations when artifacts are unavailable
When artifacts are unavailable you now get a specific reason, including org policy or custom base URL.
named in this entry
-
v2.1.2291M-context models no longer suppressed on custom endpoints
Subscription users on a custom base URL now see the 1M-context model variants again.
named in this entry
-
v2.1.229OpenTelemetry can be sent through Anthropic's first-party gateway
Telemetry can route through Anthropic's own gateway, but only under a narrow set of conditions.
named in this entry
-
v2.1.228About 220 more environment variables move to the typed registry
About 220 environment variables now parse and validate in one place, including bounds checks.
named in this entry
-
v2.1.224Runner management tools require a first-party login and say so
Runner management tools now require
claude loginon Anthropic's API; API keys are rejected.named in this entry
-
v2.1.223Gateway model discovery accepts model ids that merely contain claude or anthropic
Gateways whose model ids carry a vendor prefix now show up instead of an empty model list.
named in this entry
-
v2.1.223Settings-supplied API and credential env vars are stripped when ANTHROPIC_UNIX_SOCKET is set
When you connect through a unix socket, settings files can no longer override your API keys or endpoint.
named in this entry
-
v2.1.221Tool search no longer disabled on Vertex AI
Tool search now runs on Vertex AI instead of being refused outright.
named in this entry
-
v2.1.219Remote Control now explains exactly which endpoint setting blocks it
When Remote Control refuses, it now names the exact setting or variable blocking it.
named in this entry
Documentation pages
- Environment variables reference table Claude Code CLI
- On a remote host without a browser: mentions it Claude Developer Platform
- csharp mentions it Claude Developer Platform
- java mentions it Claude Developer Platform
- For Amazon Bedrock support mentions it Claude Developer Platform
- cmek mentions it Claude Developer Platform
- spawn.sh: called once per claimed work item mentions it Claude Developer Platform
- Escalate hard decisions with the advisor tool mentions it Claude Code CLI
- Hosting the Agent SDK mentions it Claude Code CLI
- Securely deploying AI agents mentions it Claude Code CLI
- Scale to many tools with tool search mentions it Claude Code CLI
- Manage multiple agents with agent view mentions it Claude Code CLI
- Authentication mentions it Claude Code CLI
A reference table page is one whose own table defines this name, and it is where the description above came from. A page that mentions it carries the name somewhere in its text and may say nothing about it at all. Every page carrying it.
Names beside it
Every environment variable in the inventory starting anthropic, up to twelve of them.
ANTHROPIC_API_KEYAPI key sent as X-Api-Key header. When set, this key is used instead of your Claude Pro, Max, Team, or Enterprise subscription even if you are logged in. In non-interactive mode (-p), the key is always used when present. In interactive mode, you are prompted to approve the key once before it overrides your subscription. To use your subscription instead, run unset ANTHROPIC_API_KEY 2.1.138
ANTHROPIC_AUTH_TOKENCustom value for the Authorization header (the value you set here will be prefixed with Bearer ) 2.1.138
ANTHROPIC_AWS_API_KEYWorkspace API key for [Claude Platform on AWS](/docs/en/claude-platform-on-aws), generated in the AWS Console. Sent as x-api-key and takes precedence over AWS SigV4 2.1.138
ANTHROPIC_AWS_BASE_URLOverride the [Claude Platform on AWS](/docs/en/claude-platform-on-aws) endpoint URL. Use for custom regions or when routing through an [LLM gateway](/docs/en/llm-gateway). Defaults to https://aws-external-anthropic.{region}.api.aws. Claude Code resolves the region with the [same precedence as on Amazon Bedrock](/docs/en/amazon-bedrock#3-configure-claude-code) 2.1.138
ANTHROPIC_AWS_WORKSPACE_IDRequired for [Claude Platform on AWS](/docs/en/claude-platform-on-aws). Sent on every request as the anthropic-workspace-id header 2.1.138
ANTHROPIC_BEDROCK_BASE_URLOverride the Amazon Bedrock endpoint URL. Use for custom Amazon Bedrock endpoints or when routing through an [LLM gateway](/docs/en/llm-gateway). See [Amazon Bedrock](/docs/en/amazon-bedrock) 2.1.138
ANTHROPIC_BEDROCK_MANTLE_BASE_URLOverride the Amazon Bedrock Mantle endpoint URL. See [Mantle endpoint](/docs/en/amazon-bedrock#use-the-mantle-endpoint) 2.1.138
ANTHROPIC_BEDROCK_REGION_PREFIXCross-region inference profile prefix (us, eu, apac, jp, au, or global) Claude Code tries first instead of the one derived from the AWS region. Ignored in AWS GovCloud regions. Requires Claude Code v2.1.224 or later. See [Amazon Bedrock](/docs/en/amazon-bedrock#cross-region-inference-profile-prefixes) 2.1.224
ANTHROPIC_BEDROCK_SERVICE_TIERAmazon Bedrock [service tier](https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html) (default, flex, or priority). Sent as the X-Amzn-Bedrock-Service-Tier header. See [Amazon Bedrock](/docs/en/amazon-bedrock#service-tiers) 2.1.138
ANTHROPIC_BETASComma-separated list of additional anthropic-beta header values to include in API requests. Claude Code already sends the beta headers it needs; use this to opt into an [Anthropic API beta](https://platform.claude.com/docs/en/api/beta-headers) before Claude Code adds native support. Unlike the [--betas flag](/docs/en/cli-reference#cli-flags), which requires API key authentication, this variable works with all auth methods including Claude.ai subscription 2.1.138
ANTHROPIC_CONFIG_DIRNo description from anybody. 2.1.138
ANTHROPIC_CUSTOM_HEADERSCustom headers to add to requests (Name: Value format, newline-separated for multiple headers). If a name or value contains a character an HTTP header can't carry, such as a curly quote or a zero-width space, Claude Code fails the request with an error that identifies the pair by position. Requires Claude Code v2.1.227 or later. [Invalid request header value](/docs/en/errors#invalid-request-header-value) lists the exact character set and where the check runs 2.1.138
Read out of the published npm bundle release by release, and out of Anthropic's own documentation as this site captured it. Nothing on this page is a description anybody here wrote about what the environment variable does. All environment variables.