diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py b/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py index 38fbeb65510..4a222744c9d 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/handler.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: # Anthropic-only keys already mapped by the translator; strip on extra_kwargs re-merge. ANTHROPIC_ONLY_REQUEST_KEYS: frozenset[str] = frozenset( - {"output_config", "context_management", "_polyfill_result"} + {"output_config", "context_management"} ) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py index b51a3c69d65..517ee984006 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py @@ -208,11 +208,13 @@ class AnthropicStreamWrapper(AdapterCompletionStreamWrapper): return self.chunk_queue.popleft() if self.queued_usage_chunk: - # Usage has already been merged + emitted. Pass any trailing - # provider events through directly instead of silently - # dropping them in the for-loop body. - self.chunk_queue.append(processed_chunk) - return self.chunk_queue.popleft() + # Usage has already been merged + emitted. Any trailing + # provider events would violate Anthropic SSE ordering + # (no chunks may follow the final ``message_delta``), so + # silently drop them — matches the async ``__anext__`` + # behavior where the block-handling logic is gated on + # ``not self.queued_usage_chunk``. + continue if should_start_new_block and not self.sent_content_block_finish: # Queue the sequence: content_block_stop -> content_block_start