-
Notifications
You must be signed in to change notification settings - Fork 1
fix(ai): use pass-through endpoint for Claude Max OAuth forwarding #965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,24 @@ data: | |
| # Required to configure self-hosted SearXNG endpoint | ||
| allow_client_side_credentials: true | ||
|
|
||
| # ===================================================== | ||
| # STORY-063: Anthropic Pass-Through for Claude Max OAuth | ||
| # Workaround for LiteLLM bug (Issue #19618) where Authorization | ||
| # header is stripped before forwarding to Anthropic. | ||
| # Pass-through with forward_headers: true preserves OAuth token. | ||
| # Reference: https://docs.litellm.ai/docs/pass_through/anthropic_completion | ||
| # ===================================================== | ||
| pass_through_endpoints: | ||
| - path: "/anthropic" | ||
| target: "https://api.anthropic.com" | ||
| forward_headers: true | ||
| auth: true | ||
|
Comment on lines
+238
to
+241
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In LiteLLM pass-through endpoints, header forwarding is currently all-or-nothing:
Example (forwards everything): general_settings:
pass_through_endpoints:
- path: "/v1/rerank"
target: "https://api.cohere.com/v1/rerank"
headers:
Authorization: "bearer os.environ/COHERE_API_KEY"
content-type: application/json
accept: application/json
forward_headers: trueIf you need an allowlist (only some headers)You’ll need to do it outside of pass-through, e.g.:
Related (non pass-through) header forwarding controlsFor normal model calls (not pass-through), LiteLLM provides Also note there’s been historical confusion/bugs around pass-through header behavior (see GitHub issue). (github.com) Citations:
🌐 Web query:
💡 Result: LiteLLM “pass-through proxy” header forwarding is documented under Pass Through Endpoints:
Related (non-pass-through) header forwarding docs (for forwarding client headers to LLM provider APIs, not arbitrary pass-through targets):
Sources: Citations:
🌐 Web query:
💡 Result: LiteLLM has two different “forward headers” features, and neither currently supports an 1) Proxy → LLM provider header forwarding (model-group controlled)This is configured via
2) Pass-through endpoints header forwardingFor general_settings:
pass_through_endpoints:
- path: "/v1/..."
target: "https://..."
forward_headers: true
If you need a whitelist today
Sources: Forward client headers docs [1], pass-through endpoint docs [2], related GitHub issue discussing header pass-through control [3]. Remove
Without one of these mitigations, all client headers are forwarded to the external Anthropic API. 🤖 Prompt for AI Agents |
||
| guardrails: | ||
| lakera-guard: | ||
| request_fields: ["messages[*].content"] | ||
| openai-mod: | ||
| request_fields: ["messages[*].content"] | ||
|
|
||
| litellm_settings: | ||
| # Drop unsupported params instead of erroring | ||
| drop_params: true | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forward_headers: truewill forward all incoming headers tohttps://api.anthropic.com, which can leak LiteLLM authentication material (e.g.,Authorization: Bearer <master/virtual key>for clients that use bearer auth, and/orx-litellm-api-key) to the upstream provider. Since litellm ingress allows traffic from any pod in theainamespace (and the internal gateway), this is a real credential-exfil path. Prefer forwarding only the minimal required header(s) for Claude Max OAuth (typicallyAuthorization) and explicitly ensure LiteLLM auth headers are not forwarded upstream (e.g., via an allowlist/denylist mechanism or a dedicated auth header for LiteLLM separate fromAuthorization).