Skip to main content

anthropic_api_key_available

Function anthropic_api_key_available 

Source
pub fn anthropic_api_key_available(home: &Path) -> bool
Expand description

Returns true when an Anthropic API key is available for the proxy to forward upstream.

The proxy never injects credentials (see proxy/forward.rs — only ALLOWED_REQUEST_HEADERS are forwarded), so it can only help Claude Code when the user runs in API-key (pay-as-you-go) mode. A Claude Pro/Max subscription authenticates via OAuth directly against api.anthropic.com; that token is rejected by any custom ANTHROPIC_BASE_URL, so redirecting subscription traffic through the proxy only breaks auth (login loop / 401). When this returns false, callers must NOT point Claude Code at the proxy.