litellm - 💡(How to fix) Fix use_chat_completions_api: true drops content when provider returns reasoning_content [1 pull requests]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fixed

Code Example

{"type":"message","content":[{"type":"text","text":"hello"}],"stop_reason":"end_turn"}

---

{"type":"message","content":[],"stop_reason":"end_turn"}

---

model_list:
  - model_name: deepseek-v4-flash
    litellm_params:
      model: openai/deepseek-v4-flash
      api_base: https://opencode.ai/zen/go/v1
      api_key: os.environ/OPENCODE_GO_API_KEY
      use_chat_completions_api: true
RAW_BUFFERClick to expand / collapse

Bug Description

When use_chat_completions_api: true is configured on a model with model: openai/..., the proxy correctly calls the upstream OpenAI API's /v1/chat/completions endpoint. However, when converting the response back to Anthropic Messages API format, the content field is dropped when the upstream also returns reasoning_content (a non-standard field used by DeepSeek, Kimi, etc. for chain-of-thought).

Expected

The Anthropic-format response should include the model text content:

{"type":"message","content":[{"type":"text","text":"hello"}],"stop_reason":"end_turn"}

Actual

Response has empty content when upstream includes reasoning:

{"type":"message","content":[],"stop_reason":"end_turn"}

Steps

  1. Config:
model_list:
  - model_name: deepseek-v4-flash
    litellm_params:
      model: openai/deepseek-v4-flash
      api_base: https://opencode.ai/zen/go/v1
      api_key: os.environ/OPENCODE_GO_API_KEY
      use_chat_completions_api: true
  1. Start proxy: litellm --config config.yaml --port 4000

  2. Send request via /v1/messages (Anthropic): curl http://localhost:4000/v1/messages -H "Authorization: Bearer sk-test" -H "anthropic-version: 2023-06-01" -d '{"model":"deepseek-v4-flash","max_tokens":200,"messages":[{"role":"user","content":"say hello"}]}'

  3. Result: empty content

  4. Same request via /v1/chat/completions (OpenAI) works and returns content: "hello" with reasoning_content: "Thinking...".

The reasoning_content field triggers a code path that leaves the final message with empty content.

Environment

LiteLLM 1.83.14, Python 3.13.3, macOS Affected providers: DeepSeek (opencode.ai), Kimi (CanopyWave) - any provider returning reasoning_content

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix use_chat_completions_api: true drops content when provider returns reasoning_content [1 pull requests]