openclaw - 💡(How to fix) Fix [Bug]: DeepSeek V4 via OpenRouter fails on follow-up/tool turns with reasoning_content error because DeepSeek wrapper only applies to provider=deepseek [2 comments, 3 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#76018Fetched 2026-05-03 04:43:15
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
2
Author
Timeline (top)
commented ×2labeled ×2closed ×1cross-referenced ×1

When using deepseek/deepseek-v4-flash through OpenRouter in OpenClaw, follow-up turns can fail with:

code: 20015 The reasoning_content in the thinking mode must be passed back to the API.

This appears to happen because OpenClaw's DeepSeek-specific handling for reasoning_content only activates for provider = "deepseek", not for OpenRouter-routed DeepSeek models. As a result, the conversation history is not normalized/replayed in the way DeepSeek expects on subsequent turns. [docs mention special handling for DeepSeek V4 models in the native DeepSeek provider path.]

Error Message

  1. Observe upstream failure with error 20015
  • Error returned by upstream:

Root Cause

This appears to happen because OpenClaw's DeepSeek-specific handling for reasoning_content only activates for provider = "deepseek", not for OpenRouter-routed DeepSeek models. As a result, the conversation history is not normalized/replayed in the way DeepSeek expects on subsequent turns. [docs mention special handling for DeepSeek V4 models in the native DeepSeek provider path.]

RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

When using deepseek/deepseek-v4-flash through OpenRouter in OpenClaw, follow-up turns can fail with:

code: 20015 The reasoning_content in the thinking mode must be passed back to the API.

This appears to happen because OpenClaw's DeepSeek-specific handling for reasoning_content only activates for provider = "deepseek", not for OpenRouter-routed DeepSeek models. As a result, the conversation history is not normalized/replayed in the way DeepSeek expects on subsequent turns. [docs mention special handling for DeepSeek V4 models in the native DeepSeek provider path.]

Steps to reproduce

  1. Configure OpenClaw to use OpenRouter
  2. Set model to deepseek/deepseek-v4-flash
  3. Start a conversation
  4. Send an initial prompt
  5. Send a follow-up prompt, or trigger a tool call and then continue the conversation
  6. Observe upstream failure with error 20015

Expected behavior

OpenClaw should detect DeepSeek V4 models even when routed through OpenRouter and apply the same normalization/replay behavior as the native DeepSeek provider path, including handling of reasoning_content across follow-up and tool-call turns.

At minimum, OpenClaw should not break multi-turn conversations for OpenRouter-routed DeepSeek V4 models that require reasoning continuity.

Actual behavior

  • Model: deepseek/deepseek-v4-flash via OpenRouter
  • Provider in config: openrouter
  • OpenClaw works on the first turn, but follow-up turns and especially tool-call flows may fail
  • Error returned by upstream:
    • code: 20015
    • The reasoning_content in the thinking mode must be passed back to the API.

In practice:

  • if the model emits reasoning_content, DeepSeek expects that content to be echoed/replayed correctly on subsequent requests
  • OpenClaw seems to do the right thing only for native provider=deepseek
  • for provider=openrouter, the DeepSeek V4 wrapper/path does not seem to run, so the request format/history becomes inconsistent for DeepSeek

OpenClaw version

2026.4.29

Operating system

debian 12.1

Install method

No response

Model

deepseek-v4-flash

Provider / routing chain

openrouter, various providers

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to modify OpenClaw's DeepSeek-specific handling to activate for OpenRouter-routed DeepSeek models, ensuring reasoning_content is properly passed back to the API.

Guidance

  • Verify that the issue is indeed caused by the missing DeepSeek-specific handling for OpenRouter-routed models by checking the OpenClaw configuration and logs.
  • Update the OpenClaw code to detect DeepSeek V4 models even when routed through OpenRouter and apply the necessary normalization/replay behavior, including handling of reasoning_content.
  • Test the updated code with the deepseek/deepseek-v4-flash model via OpenRouter to ensure multi-turn conversations work as expected.
  • Consider adding a check to ensure that the reasoning_content is correctly echoed/replayed on subsequent requests for OpenRouter-routed DeepSeek V4 models.

Example

No code snippet is provided as the issue does not include sufficient details about the OpenClaw codebase.

Notes

The fix may require modifications to the OpenClaw codebase, and the exact implementation details are not provided in the issue. Additionally, the issue may be specific to the deepseek/deepseek-v4-flash model and OpenRouter configuration.

Recommendation

Apply a workaround by modifying the OpenClaw configuration to use the native DeepSeek provider path for the deepseek/deepseek-v4-flash model, if possible, until a permanent fix is implemented. This is because the native DeepSeek provider path is known to work correctly with DeepSeek V4 models.

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…

FAQ

Expected behavior

OpenClaw should detect DeepSeek V4 models even when routed through OpenRouter and apply the same normalization/replay behavior as the native DeepSeek provider path, including handling of reasoning_content across follow-up and tool-call turns.

At minimum, OpenClaw should not break multi-turn conversations for OpenRouter-routed DeepSeek V4 models that require reasoning continuity.

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 via OpenRouter fails on follow-up/tool turns with reasoning_content error because DeepSeek wrapper only applies to provider=deepseek [2 comments, 3 participants]