From 282efd18b41c5a3acc76411ddef02a3c11696f43 Mon Sep 17 00:00:00 2001 From: Vigilans Date: Thu, 16 Apr 2026 14:23:00 +0800 Subject: [PATCH] fix(responses): deduplicate message_start when response.created races with fallback --- .../responses_adapters/streaming_iterator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py index 461d254087d..4463732d265 100644 --- a/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py +++ b/litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py @@ -86,8 +86,9 @@ class AnthropicResponsesStreamWrapper: # ---- message_start ---- if event_type == "response.created": - self._sent_message_start = True - self._chunk_queue.append(self._make_message_start()) + if not self._sent_message_start: + self._sent_message_start = True + self._chunk_queue.append(self._make_message_start()) return # ---- content_block_start for a new output message item ----