openclaw - 💡(How to fix) Fix [Bug] DeepSeek V4 thinking mode fails with 400: reasoning_content must be passed back on multi-turn tool calls [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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…
GitHub stats
openclaw/openclaw#71435Fetched 2026-04-26 05:12:41
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1

When using DeepSeek V4 models (deepseek-v4-flash / deepseek-v4-pro) with thinking mode enabled, multi-turn conversations that involve tool calls fail with a 400 error:

The `content[].thinking` in the thinking mode must be passed back to the API.

This happens on every follow-up request after the first assistant response that includes both thinking and tool calls. The DeepSeek API requires reasoning_content from prior assistant turns to be replayed in subsequent requests, but OpenClaw 2026.4.23 does not properly replay the thinking/reasoning content when constructing multi-turn tool-call history.

Error Message

When using DeepSeek V4 models (deepseek-v4-flash / deepseek-v4-pro) with thinking mode enabled, multi-turn conversations that involve tool calls fail with a 400 error: The 400 error occurs, and OpenClaw falls back to the next model in the fallback chain. Gateway logs show: "error": "LLM request failed: provider rejected the request schema or tool payload.", "rawErrorPreview": "400 {"error":{"message":"The content[].thinking in the thinking mode must be passed back to the API.","type":"invalid_request_error"}}", Setting params.thinking.type: "disabled" in the model allowlist entry prevents the error by disabling thinking mode, but this sacrifices V4's reasoning capability:

Root Cause

When using DeepSeek V4 models (deepseek-v4-flash / deepseek-v4-pro) with thinking mode enabled, multi-turn conversations that involve tool calls fail with a 400 error:

The `content[].thinking` in the thinking mode must be passed back to the API.

This happens on every follow-up request after the first assistant response that includes both thinking and tool calls. The DeepSeek API requires reasoning_content from prior assistant turns to be replayed in subsequent requests, but OpenClaw 2026.4.23 does not properly replay the thinking/reasoning content when constructing multi-turn tool-call history.

Fix Action

Workaround

Setting params.thinking.type: "disabled" in the model allowlist entry prevents the error by disabling thinking mode, but this sacrifices V4's reasoning capability:

{
  "agents": {
    "defaults": {
      "models": {
        "deepseek/deepseek-v4-flash": { "alias": "ds4", "params": { "thinking": { "type": "disabled" } } },
        "deepseek/deepseek-v4-pro": { "alias": "ds4p", "params": { "thinking": { "type": "disabled" } } }
      }
    }
  }
}

Code Example

The `content[].thinking` in the thinking mode must be passed back to the API.

---

{
  "error": "LLM request failed: provider rejected the request schema or tool payload.",
  "failoverReason": "format",
  "model": "deepseek-v4-pro",
  "provider": "deepseek",
  "rawErrorPreview": "400 {\"error\":{\"message\":\"The `content[].thinking` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\"}}",
  "providerRuntimeFailureKind": "schema"
}

---

{
  "agents": {
    "defaults": {
      "models": {
        "deepseek/deepseek-v4-flash": { "alias": "ds4", "params": { "thinking": { "type": "disabled" } } },
        "deepseek/deepseek-v4-pro": { "alias": "ds4p", "params": { "thinking": { "type": "disabled" } } }
      }
    }
  }
}
RAW_BUFFERClick to expand / collapse

Bug Report

Description

When using DeepSeek V4 models (deepseek-v4-flash / deepseek-v4-pro) with thinking mode enabled, multi-turn conversations that involve tool calls fail with a 400 error:

The `content[].thinking` in the thinking mode must be passed back to the API.

This happens on every follow-up request after the first assistant response that includes both thinking and tool calls. The DeepSeek API requires reasoning_content from prior assistant turns to be replayed in subsequent requests, but OpenClaw 2026.4.23 does not properly replay the thinking/reasoning content when constructing multi-turn tool-call history.

Environment

  • OpenClaw version: 2026.4.23 (a979721)
  • Provider: deepseek (direct API, base_url: https://api.deepseek.com, api: openai-completions)
  • Models affected: deepseek/deepseek-v4-flash, deepseek/deepseek-v4-pro
  • DeepSeek API key: valid, works for single-turn requests
  • OS: macOS 26.3 (arm64)

Steps to Reproduce

  1. Configure DeepSeek V4 models in openclaw.json with the official OpenAI-compatible endpoint
  2. Enable thinking mode (do NOT set params.thinking.type: "disabled")
  3. Start a conversation that triggers a tool call (e.g., web_search, exec)
  4. On the next user turn, the request fails with 400

Expected Behavior

OpenClaw should replay the prior assistant reasoning_content in the follow-up request, as documented in DeepSeek Thinking Mode and the OpenClaw DeepSeek docs. The docs state:

V4 models support DeepSeek's thinking control. OpenClaw also replays DeepSeek reasoning_content on follow-up turns so thinking sessions with tool calls can continue.

Actual Behavior

The 400 error occurs, and OpenClaw falls back to the next model in the fallback chain. Gateway logs show:

{
  "error": "LLM request failed: provider rejected the request schema or tool payload.",
  "failoverReason": "format",
  "model": "deepseek-v4-pro",
  "provider": "deepseek",
  "rawErrorPreview": "400 {\"error\":{\"message\":\"The `content[].thinking` in the thinking mode must be passed back to the API.\",\"type\":\"invalid_request_error\"}}",
  "providerRuntimeFailureKind": "schema"
}

Workaround

Setting params.thinking.type: "disabled" in the model allowlist entry prevents the error by disabling thinking mode, but this sacrifices V4's reasoning capability:

{
  "agents": {
    "defaults": {
      "models": {
        "deepseek/deepseek-v4-flash": { "alias": "ds4", "params": { "thinking": { "type": "disabled" } } },
        "deepseek/deepseek-v4-pro": { "alias": "ds4p", "params": { "thinking": { "type": "disabled" } } }
      }
    }
  }
}

Additional Context

  • Same issue reported in other agent frameworks: OpenCode #24104, OpenCode #24097, QwenPaw #3782
  • The bundled DeepSeek plugin catalog in 2026.4.23 still only exposes deepseek-chat / deepseek-reasoner (V3.2 surfaces), not the V4 models. V4 models require manual provider configuration.
  • DeepSeek has announced that deepseek-chat and deepseek-reasoner will be retired on 2026-07-24, making V4 thinking support increasingly important.

extent analysis

TL;DR

To fix the 400 error with DeepSeek V4 models and thinking mode enabled, ensure that OpenClaw properly replays the prior assistant reasoning_content in follow-up requests.

Guidance

  • Verify that the reasoning_content from prior assistant turns is being correctly replayed in subsequent requests by checking the request payload sent to the DeepSeek API.
  • Review the OpenClaw configuration to ensure that thinking mode is enabled and properly set up for the DeepSeek V4 models.
  • Consider updating the OpenClaw version or waiting for a patch, as the issue may be resolved in a future release.
  • As a temporary workaround, disable thinking mode by setting params.thinking.type: "disabled" in the model allowlist entry, but be aware that this will sacrifice V4's reasoning capability.

Example

{
  "agents": {
    "defaults": {
      "models": {
        "deepseek/deepseek-v4-flash": { "alias": "ds4", "params": { "thinking": { "type": "enabled" } } },
        "deepseek/deepseek-v4-pro": { "alias": "ds4p", "params": { "thinking": { "type": "enabled" } } }
      }
    }
  }
}

Note: This example assumes that the thinking mode is enabled, but the actual implementation may vary depending on the OpenClaw configuration.

Notes

The issue seems to be related to the OpenClaw version (2026.4.23) and its handling of DeepSeek V4 models with thinking mode enabled. The problem may be resolved in a future release or by updating the OpenClaw configuration.

Recommendation

Apply the workaround by setting params.thinking.type: "disabled" in the model allowlist entry, as this will prevent the 400 error, but keep in mind that it will disable the V4 reasoning

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

openclaw - 💡(How to fix) Fix [Bug] DeepSeek V4 thinking mode fails with 400: reasoning_content must be passed back on multi-turn tool calls [1 comments, 2 participants]