hermes - ✅(Solved) Fix DeepSeek API: Missing 'thinking: disabled' parameter causes 400 error [1 pull requests, 2 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
NousResearch/hermes-agent#15700Fetched 2026-04-26 05:25:43
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×2cross-referenced ×2

Root Cause

In agent/anthropic_adapter.py (line ~1659), when reasoning_config.enabled = False:

if reasoning_config.get("enabled") is not False and "haiku" not in model.lower():
    # sets thinking parameter

The code skips setting the thinking parameter when disabled, but DeepSeek API requires explicit thinking: {"type": "disabled"} to turn off thinking mode. Without this parameter, DeepSeek defaults to thinking mode enabled.

Fix Action

Workaround

Currently, users must either:

  1. Modify source code locally (lost on upgrade)
  2. Use OpenAI-compatible endpoint instead

PR fix notes

PR #15712: fix(anthropic): send thinking=disabled explicitly on third-party endpoints (#15700)

Description (problem / solution / changelog)

Summary

  • Third-party Anthropic-compatible endpoints (e.g. DeepSeek /anthropic) default to thinking mode when the thinking parameter is absent; native Anthropic disables thinking by default
  • When reasoning_config.enabled = False, Hermes now sends thinking: {"type": "disabled"} for third-party endpoints so they don't default to thinking on
  • Kimi /coding and native Anthropic are unaffected

The bug

build_anthropic_kwargs sets thinking only when thinking is enabled. For native Anthropic that is correct — thinking is disabled by default. But DeepSeek's /anthropic endpoint treats the absent parameter as "thinking enabled", causing every request with enabled=False to fail with HTTP 400:

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

The fix

Added an elif branch inside the existing reasoning_config block at agent/anthropic_adapter.py:

elif reasoning_config.get("enabled") is False and _is_third_party_anthropic_endpoint(base_url):
    kwargs["thinking"] = {"type": "disabled"}

_is_third_party_anthropic_endpoint returns True for any non-anthropic.com base URL. Kimi /coding is already excluded by the outer not _is_kimi_coding guard.

Test plan

  • Before: 2 of 4 new tests fail (assert None == {'type': 'disabled'}) — regression guard confirmed
  • After: all 4 new tests pass
  • Regression guard: reverted fix → test_reasoning_disabled_third_party_sends_explicit_disabled and test_reasoning_disabled_third_party_any_provider both fail with AssertionError: assert None == {'type': 'disabled'}; restored → 0 failures
  • tests/agent/test_anthropic_adapter.py — 131 passed, 10 pre-existing baseline failures (unchanged)
  • tests/agent/test_kimi_coding_anthropic_thinking.py — 8 passed (unchanged)
  • Existing test_reasoning_disabled still passes (native Anthropic still omits the key)

New test cases:

  • test_reasoning_disabled_third_party_sends_explicit_disabled — DeepSeek endpoint gets {"type": "disabled"}
  • test_reasoning_disabled_third_party_any_provider — any non-Anthropic endpoint gets {"type": "disabled"}
  • test_reasoning_disabled_kimi_coding_omits_thinking — Kimi /coding gets neither enabled nor disabled
  • test_reasoning_none_third_party_omits_thinkingreasoning_config=None on third-party endpoint still omits thinking

Related

  • Fixes #15700

🤖 Generated with Claude Code

Changed files

  • agent/anthropic_adapter.py (modified, +12/-2)
  • tests/agent/test_anthropic_adapter.py (modified, +68/-0)

Code Example

HTTP 400: The content[].thinking in the thinking mode must be passed back to the API.

---

if reasoning_config.get("enabled") is not False and "haiku" not in model.lower():
    # sets thinking parameter

---

kwargs["thinking"] = {"type": "disabled"}
RAW_BUFFERClick to expand / collapse

Problem

When using DeepSeek API with Anthropic-compatible endpoint (https://api.deepseek.com/anthropic), Hermes fails with:

HTTP 400: The content[].thinking in the thinking mode must be passed back to the API.

Root Cause

In agent/anthropic_adapter.py (line ~1659), when reasoning_config.enabled = False:

if reasoning_config.get("enabled") is not False and "haiku" not in model.lower():
    # sets thinking parameter

The code skips setting the thinking parameter when disabled, but DeepSeek API requires explicit thinking: {"type": "disabled"} to turn off thinking mode. Without this parameter, DeepSeek defaults to thinking mode enabled.

Expected Behavior

When reasoning_config.enabled = False, Hermes should send:

kwargs["thinking"] = {"type": "disabled"}

Workaround

Currently, users must either:

  1. Modify source code locally (lost on upgrade)
  2. Use OpenAI-compatible endpoint instead

Environment

  • Hermes Agent: latest (main branch)
  • Provider: DeepSeek API
  • Endpoint: https://api.deepseek.com/anthropic
  • Model: deepseek-v4-flash (and other DeepSeek models)

Related

DeepSeek API documentation: https://api-docs.deepseek.com/quick_start/pricing

extent analysis

TL;DR

To fix the issue, Hermes should explicitly set the thinking parameter to {"type": "disabled"} when reasoning_config.enabled is False.

Guidance

  • Modify the agent/anthropic_adapter.py file to set the thinking parameter when reasoning_config.enabled is False, as shown in the Expected Behavior section.
  • Verify that the thinking parameter is being sent correctly by checking the API request payload.
  • Consider using the OpenAI-compatible endpoint as a temporary workaround until the issue is resolved.
  • Review the DeepSeek API documentation to ensure that the thinking parameter is properly formatted and sent in the API request.

Example

if reasoning_config.get("enabled") is False:
    kwargs["thinking"] = {"type": "disabled"}

Notes

This fix assumes that the issue is solely due to the missing thinking parameter. If other issues are present, additional debugging may be necessary.

Recommendation

Apply workaround: Modify the agent/anthropic_adapter.py file to set the thinking parameter when reasoning_config.enabled is False, as this is a targeted fix for the identified issue.

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