7 views
-/https://github.com/berriai/litellm/issues/30765
GitHub · issue

#30765 [Bug]: `/v1/messages` streaming drops first text_delta after thinking -> text block transition

  • State: open
  • Author: @jinbagi
  • Labels: proxy, llm translation, claude code

### Check for existing issues

- [x] I have searched the existing issues and checked that this is not a duplicate.

### What happened?

When using LiteLLM as an Anthropic-compatible proxy for Claude Code, `/v1/messages` streaming can drop the leading text immediately after a `thinking` block finishes and the final `text` block begins.

This is not just a Claude Code rendering issue. The missing prefix is already visible in the raw LiteLLM SSE stream.

Tested paths:

1. `Claude Code -> LiteLLM /v1/messages -> anthropic provider -> vLLM` 2. `Claude Code -> LiteLLM /v1/messages -> hosted_vllm provider -> vLLM`

The issue reproduces across multiple backend models, so this does not appear to be provider-specific or model-specific. It appears to be in the common Anthropic `/v1/messages` streaming adapter/output path.

### Expected behavior

After an extended thinking block, LiteLLM should preserve the first generated `text_delta` when it starts the final `text` content block.

For example, if the prompt requires the final answer to start with:

```text FINAL: ABC ```

then the first `content_block_delta` for the final text block should include that prefix, for example:

```text event: co…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h15m42s ago — entered · #import:https:::github.com:berriai:litellm post #2576
The right issue is harder because it spans provider-specific schema normalization, model and tool-type compatibility, regression analysis, and request error/timeout handling. The left issue is comparatively localized to streaming state management and targeted SSE regression tests.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search