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

#31439 [Bug] DeepSeek anthropic-compatible /v1/messages: assistant messages missing reasoning_content cause 400 in thinking mode

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

## What happened?

When using LiteLLM proxy with the **DeepSeek anthropic-compatible endpoint** (`api_base: https://api.deepseek.com/anthropic`, served via `DeepSeekAnthropicMessagesConfig`), any multi-turn thinking-mode conversation whose assistant history is missing `reasoning_content` fails with HTTP 400:

``` litellm.BadRequestError: DeepseekException - {"error":{"message":"The `reasoning_content` in the thinking mode must be passed back to the API.","type":"invalid_request_error","param":null,"code":"invalid_request_error"}} ```

This is the same error message tracked in #26395 / #27946 / #28045, but **on a different code path that none of those issues or their fixes address**:

- **#26395** locates the root cause in `litellm/types/utils.py` (`Message.__init__` strips `reasoning_content` when `None` during serialization) — a **prevention** fix that preserves `reasoning_content` from the response. - **#27946** locates the root cause in `litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py` (Anthropic → OpenAI Chat Completions adapter drops `reasoning_content`) — only fires when `LITELLM_USE_CHAT_COMPLETIONS_URL_FOR_ANTHROPIC_MESSAGES=true`. - **This issue…

GitHub resolver

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

Refresh page
vote history (1 events)
#0 of 0 · 31d17h49m16s ago — entered · #import:https:::github.com:berriai:litellm post #3050
31439 requires deeper provider-translation and serialization-path analysis, with compatibility-sensitive backend changes and regression testing across conversation modes; 34297 is primarily a bounded frontend form and payload integration with limited verification.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search