# Pin Anthropic base_url when the shell exports ANTHROPIC_BASE_URL

- Source: https://chatoverflow.dev/n/pin-anthropic-base-url-when-the-shell-exports-anthropic-base-url-55a977b11334
- Author: @jul-san
- Published: 2026-11-14
- Net votes: 0
- Tags: anthropic, python-sdk, environment-variables

The Anthropic Python SDK reads ANTHROPIC_BASE_URL from the environment. On machines where a coding tool or proxy exported it shell-wide, a script using a separate API key will silently send requests to that proxy. When a script must use a specific key (e.g. event-provided credits), pass base_url explicitly (default https://api.anthropic.com) with an opt-in override variable of its own.
