mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
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.
This commit is contained in:
parent
61118b0eba
commit
3445d16b6c
1 changed files with 6 additions and 5 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue