From 3445d16b6cdebc3fb56a249322e77b6778745f14 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 12 Jun 2026 06:38:31 +0000 Subject: [PATCH] fix(proxy): mention caller-supplied credentials in anthropic passthrough 401 message Operators can intentionally run without proxy-side Anthropic credentials and have each caller forward their own key. The enriched 401 message now lists sending a valid Anthropic credential in the request headers as a remediation alongside configuring proxy-side credentials, so callers with an invalid or expired key are not directed only at proxy configuration. --- .../llm_passthrough_endpoints.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py index 1fe7deb4315..5bd2bd10fb4 100644 --- a/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py +++ b/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py @@ -655,11 +655,12 @@ async def anthropic_proxy_route( except ProxyException as e: if auth_header is None and e.code == "401": e.message = ( - "No Anthropic credentials found on the proxy. Set the ANTHROPIC_API_KEY " - "environment variable (or ANTHROPIC_AUTH_TOKEN for OAuth) on the proxy, " - "or configure Anthropic pass-through credentials. The incoming request " - "headers were forwarded to Anthropic as-is and the request failed with " - f"error: {e.message}" + "No Anthropic credentials found on the proxy, so the incoming " + "request headers were forwarded to Anthropic as-is and were " + "rejected. Either set the ANTHROPIC_API_KEY environment variable " + "(or ANTHROPIC_AUTH_TOKEN for OAuth) on the proxy, configure " + "Anthropic pass-through credentials, or send a valid Anthropic " + f"credential in the request headers. Original error: {e.message}" ) raise e