ANTHROPIC_BASE_URL
An environment variable for Claude Code used to specify the target domain to which API requests are sent, supporting access through third-party compatible providers.
Core Facts
Timeline (last 90 days)
For streaming requests via a custom ANTHROPIC_BASE_URL, if no data arrives within 180 seconds the request is aborted; this is now extended to 300 seconds.
For users in China, a common practice is to configure a proxy or use a third-party gateway compatible with the Anthropic API, and point to the alternative endpoint via environment variables such as ANTHROPIC_BASE_URL.
Claude Code can point to localhost by setting the ANTHROPIC_BASE_URL environment variable, communicating with local models without a proxy translation layer.
Meta's documentation defines three environment variables to point Claude Code at its API: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL, and requires setting the Opus, Sonnet, and Haiku aliases and the sub-agent model to the same ID to ensure no request falls back to a Claude model.
By setting environment variables such as ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL, Claude Code can be pointed at Meta's API, but only Muse Wonder is available, not Wonder Full.
Claude Code decides the domain to which requests are sent by reading the environment variable ANTHROPIC_BASE_URL, and performs authentication through ANTHROPIC_AUTH_TOKEN.
ANTHROPIC_BASE_URL specifies the API gateway address, used to forward requests originally destined for Anthropic to the chosen platform.
In v2.1.275, users who forward requests to third-party proxies or enterprise internal gateways via a custom ANTHROPIC_BASE_URL experience a 100% request failure rate.
v2.1.276 fixes an issue where every request would fail with a 400 error (Input tag 'advisor_20260301') when ANTHROPIC_BASE_URL pointed to a proxy or gateway.
Previously, telemetry and metrics requests sent to Anthropic carried the API key configured for third-party gateways (ANTHROPIC_BASE_URL); this version fixes the issue so that credentials are only sent to their corresponding host
All Facts (11)
Claude Code uses the environment variables ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY to determine the API endpoint and authentication information.
80%UnverifiedFor streaming requests via a custom ANTHROPIC_BASE_URL, if no data arrives within 180 seconds the request is aborted; this is now extended to 300 seconds.
50%UnverifiedFor users in China, a common practice is to configure a proxy or use a third-party gateway compatible with the Anthropic API, and point to the alternative endpoint via environment variables such as ANTHROPIC_BASE_URL.
50%UnverifiedClaude Code can point to localhost by setting the ANTHROPIC_BASE_URL environment variable, communicating with local models without a proxy translation layer.
50%UnverifiedBy setting environment variables such as ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL, Claude Code can be pointed at Meta's API, but only Muse Wonder is available, not Wonder Full.
50%UnverifiedMeta's documentation defines three environment variables to point Claude Code at its API: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL, and requires setting the Opus, Sonnet, and Haiku aliases and the sub-agent model to the same ID to ensure no request falls back to a Claude model.
50%UnverifiedClaude Code decides the domain to which requests are sent by reading the environment variable ANTHROPIC_BASE_URL, and performs authentication through ANTHROPIC_AUTH_TOKEN.
50%UnverifiedANTHROPIC_BASE_URL specifies the API gateway address, used to forward requests originally destined for Anthropic to the chosen platform.
50%Unverifiedv2.1.276 fixes an issue where every request would fail with a 400 error (Input tag 'advisor_20260301') when ANTHROPIC_BASE_URL pointed to a proxy or gateway.
50%UnverifiedIn v2.1.275, users who forward requests to third-party proxies or enterprise internal gateways via a custom ANTHROPIC_BASE_URL experience a 100% request failure rate.
50%UnverifiedPreviously, telemetry and metrics requests sent to Anthropic carried the API key configured for third-party gateways (ANTHROPIC_BASE_URL); this version fixes the issue so that credentials are only sent to their corresponding host
50%