{"version":"2.1.299","anchor":"result-messages-gain-api-error-origin","canonical_anchor":"result-messages-gain-api-error-origin","heading":"Claude Code is more careful with custom API endpoints and gateways","tier":"use","area":"SDK","scope":"both","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.299\/e\/result-messages-gain-api-error-origin","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.299","markdown":"### Claude Code is more careful with custom API endpoints and gateways\n\nWith a non-Anthropic ANTHROPIC_BASE_URL, the remote settings fetch withholds the API key; features it turns off are explained and gateway use is marked\n\n**What**\n\n`ANTHROPIC_BASE_URL` sends Claude Code's requests to a different address, such as a company proxy or gateway. Several changes concern what happens when that address is not an Anthropic host.\n\n- The remote settings fetch no longer sends your API key when `ANTHROPIC_BASE_URL` is not an Anthropic host. It fails with \"API key not sent: ANTHROPIC_BASE_URL is not an Anthropic host\". Before, the key was always sent as `x-api-key`. A first-party TLS request path is also checked more strictly.\n\n- Some features that depend on remote settings are turned off by an API provider or a custom base URL. Claude Code now works out who set that: a machine administrator, the process environment, a launch flag, served settings or a settings file. It then tells you which source turned the feature off, or tells you to contact your administrator.\n\n- The attribution header can now end with ` cc_gateway=1;` or ` cc_gateway=env;` when a gateway is in use and the base URL is not a vouched Anthropic host.\n\n- Result messages gain an internal `api_error_origin` field. It is marked `first_party` only when an error came from `api.anthropic.com` over verified TLS, with no base URL override or gateway.\n\n- The SDK result schema, for both success and error, also gains an optional `interrupted_by_shutdown` field.\n\n**Why**\n\nIf you route Claude Code through your own proxy, the remote settings fetch no longer hands that proxy your Anthropic API key. You also get a reason when a feature is off because of your endpoint. Programs built on the SDK can tell errors from Anthropic's own API apart from errors that passed through a proxy.\n\n- Area: SDK\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 2\/5\n- Scope: both\n- Heads-up: yes"}