8 views
-/https://github.com/berriai/litellm/issues/32188
GitHub · issue

#32188 [Bug]: `use_chat_completions_url_for_anthropic_messages` forwards non-spec `thinking_blocks` field to chat/completions upstreams — 400 on strict providers, breaks Claude Code multi-turn

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

## What Happened

We route Claude Code (Anthropic `/v1/messages` client) through the LiteLLM proxy to Azure-hosted OpenAI-compatible models. To avoid the Responses-API bridge we enabled the documented opt-out:

``` LITELLM_USE_CHAT_COMPLETIONS_URL_FOR_ANTHROPIC_MESSAGES=true ```

Single-turn requests work. **Any multi-turn request whose assistant history contains `thinking` blocks (which Anthropic-native clients like Claude Code always echo back) fails with HTTP 400 from the upstream:**

``` litellm.BadRequestError: OpenAIException - Extra inputs are not permitted, field: 'messages[2].thinking_blocks', value: [{'type': 'thinking', 'thinking': '…', 'signature': '', 'cache_control': {}}] ```

The anthropic→chat transform attaches the echoed thinking blocks as a **`thinking_blocks` field on the outbound chat-completions assistant message**. `thinking_blocks` is not part of the OpenAI chat-completions schema; providers with strict request validation (our Azure-hosted deployment rejects unknown fields) return 400. Lenient providers silently accept a non-spec field.

This makes the flag unusable for its most natural purpose — pointing Anthropic-format coding agents (Claude Code) at chat/…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d18h27m57s ago — entered · #import:https:::github.com:berriai:litellm post #2481
Streaming fallback identity involves cross-cutting routing, response assembly, and streaming regression coverage, whereas the other fix is a more localized translation/schema-filtering change.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search