From 3097f5160cb1ece876a060496aec093866bb5256 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 25 May 2026 12:58:41 +0000 Subject: [PATCH] fix(anthropic/messages): preserve drop_params for downstream and respect explicit False Co-authored-by: Yassin Kortam --- .../experimental_pass_through/messages/handler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py b/litellm/llms/anthropic/experimental_pass_through/messages/handler.py index b4109a48106..77dd2d6bd2d 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/handler.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/handler.py @@ -461,7 +461,12 @@ def anthropic_messages_handler( # In-gateway context_management polyfill on the chat-completions adapter # (native on Anthropic/Responses paths). Skipped when drop_params is on. context_management_spec = _shared_kwargs.pop("context_management", None) - _drop_params = _shared_kwargs.pop("drop_params", None) or litellm.drop_params + _request_drop_params = _shared_kwargs.get("drop_params") + _drop_params = ( + _request_drop_params + if _request_drop_params is not None + else litellm.drop_params + ) polyfill_applied_edits: List[AppliedEdit] = [] if context_management_spec and not _drop_params: from litellm.llms.anthropic.experimental_pass_through.context_management import (