diff --git a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py index 13acc0bd437..2a31c6e7e04 100644 --- a/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/messages/transformation.py @@ -163,9 +163,10 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig): continue # Only copy the block when the text changed. if stripped_text == text: - filtered_list.append(content_block) + next_block = content_block else: - filtered_list.append({**content_block, "text": stripped_text}) # mutable-ok: API message payload + next_block = {**content_block, "text": stripped_text} # mutable-ok: API message payload + filtered_list.append(next_block) else: # Keep non-dict items as-is filtered_list.append(content_block)