hermes - 💡(How to fix) Fix Xiaomi MiMo models via Anthropic-compatible relay: thinking blocks stripped causing HTTP 400 [1 pull requests]

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…

When using Xiaomi MiMo models (e.g. mimo-v2.5-pro) through an Anthropic-compatible relay/proxy with api_mode: anthropic_messages, multi-turn conversations with tool use fail with:

HTTP 400: Param Incorrect
The reasoning_content in the thinking mode must be passed back to the API.

This is the same contract as Kimi/DeepSeek thinking models — MiMo's reasoning mode returns reasoning_content (thinking blocks) that must be included in subsequent API calls. However, Hermes strips all thinking blocks for generic third-party Anthropic endpoints (line ~1787 in anthropic_adapter.py), only preserving them for Kimi and DeepSeek specifically.

Root Cause

In agent/anthropic_adapter.py, the _preserve_unsigned_thinking flag only checks for Kimi and DeepSeek:

_preserve_unsigned_thinking = (
    _is_kimi_family_endpoint(base_url, model)
    or _is_deepseek_anthropic_endpoint(base_url)
)

MiMo models accessed through generic relays (e.g. open.markhub.top) fall into the _is_third_party branch, which strips ALL thinking blocks, breaking the round-trip requirement.

Fix Action

Fixed

Code Example

HTTP 400: Param Incorrect
The reasoning_content in the thinking mode must be passed back to the API.

---

_preserve_unsigned_thinking = (
    _is_kimi_family_endpoint(base_url, model)
    or _is_deepseek_anthropic_endpoint(base_url)
)

---

custom_providers:
   - name: mimo-relay
     base_url: https://open.markhub.top
     api_key: sk-xxx
     model: mimo-v2.5-pro
     api_mode: anthropic_messages

---

_MIMO_FAMILY_MODEL_PREFIXES = ("mimo-", "mimo_")

def _model_name_is_mimo_family(model: str | None) -> bool:
    if not isinstance(model, str):
        return False
    m = model.strip().lower()
    if not m:
        return False
    if "/" in m:
        m = m.rsplit("/", 1)[-1]
    return m.startswith(_MIMO_FAMILY_MODEL_PREFIXES)

---

_preserve_unsigned_thinking = (
    _is_kimi_family_endpoint(base_url, model)
    or _is_deepseek_anthropic_endpoint(base_url)
    or _model_name_is_mimo_family(model)  # NEW
)
RAW_BUFFERClick to expand / collapse

Bug: MiMo reasoning models fail with HTTP 400 when accessed through Anthropic-compatible relays

Description

When using Xiaomi MiMo models (e.g. mimo-v2.5-pro) through an Anthropic-compatible relay/proxy with api_mode: anthropic_messages, multi-turn conversations with tool use fail with:

HTTP 400: Param Incorrect
The reasoning_content in the thinking mode must be passed back to the API.

This is the same contract as Kimi/DeepSeek thinking models — MiMo's reasoning mode returns reasoning_content (thinking blocks) that must be included in subsequent API calls. However, Hermes strips all thinking blocks for generic third-party Anthropic endpoints (line ~1787 in anthropic_adapter.py), only preserving them for Kimi and DeepSeek specifically.

Root Cause

In agent/anthropic_adapter.py, the _preserve_unsigned_thinking flag only checks for Kimi and DeepSeek:

_preserve_unsigned_thinking = (
    _is_kimi_family_endpoint(base_url, model)
    or _is_deepseek_anthropic_endpoint(base_url)
)

MiMo models accessed through generic relays (e.g. open.markhub.top) fall into the _is_third_party branch, which strips ALL thinking blocks, breaking the round-trip requirement.

Steps to Reproduce

  1. Configure a custom provider pointing to an Anthropic-compatible relay that forwards to MiMo:
    custom_providers:
    - name: mimo-relay
      base_url: https://open.markhub.top
      api_key: sk-xxx
      model: mimo-v2.5-pro
      api_mode: anthropic_messages
  2. Use the provider for a multi-turn conversation with tool calls
  3. First round succeeds (model returns thinking + tool_use blocks)
  4. Second round fails with HTTP 400: "reasoning_content must be passed back"

Proposed Fix

Add MiMo model family detection following the same pattern as Kimi:

_MIMO_FAMILY_MODEL_PREFIXES = ("mimo-", "mimo_")

def _model_name_is_mimo_family(model: str | None) -> bool:
    if not isinstance(model, str):
        return False
    m = model.strip().lower()
    if not m:
        return False
    if "/" in m:
        m = m.rsplit("/", 1)[-1]
    return m.startswith(_MIMO_FAMILY_MODEL_PREFIXES)

Then extend the preservation logic:

_preserve_unsigned_thinking = (
    _is_kimi_family_endpoint(base_url, model)
    or _is_deepseek_anthropic_endpoint(base_url)
    or _model_name_is_mimo_family(model)  # NEW
)

Verification

The fix has been tested locally:

  • ✅ Single-turn: works (baseline)
  • ✅ Multi-turn with 4 tool calls: works (was previously HTTP 400)
  • ✅ Model detection: mimo-v2.5-pro → True, kimi-k2.5 → False, claude-sonnet-4 → False

Context

  • MiMo models are Xiaomi's reasoning/thinking models, similar in contract to DeepSeek R1 and Kimi thinking models
  • The relay (markhub.top) uses Anthropic Messages API format and forwards to Xiaomi's MiMo endpoint
  • Cherry Studio (a popular Chinese AI client) works fine with the same relay because it uses OpenAI-compatible format, not Anthropic Messages format
  • The fix follows the exact same pattern already established for Kimi (#13848) and DeepSeek (#16748)

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

hermes - 💡(How to fix) Fix Xiaomi MiMo models via Anthropic-compatible relay: thinking blocks stripped causing HTTP 400 [1 pull requests]