Skip to content

fix: preserve thinking blocks for Xiaomi MiMo models via Anthropic relay - #26775

Closed
CallMe1101 wants to merge 1 commit into
NousResearch:mainfrom
CallMe1101:fix/mimo-thinking-blocks-roundtrip
Closed

fix: preserve thinking blocks for Xiaomi MiMo models via Anthropic relay#26775
CallMe1101 wants to merge 1 commit into
NousResearch:mainfrom
CallMe1101:fix/mimo-thinking-blocks-roundtrip

Conversation

@CallMe1101

Copy link
Copy Markdown

What

Preserve unsigned thinking blocks for Xiaomi MiMo reasoning models when accessed through Anthropic-compatible relays.

Why

MiMo models (e.g. mimo-v2.5-pro) use an extended-thinking mode that returns reasoning_content which must be passed back on subsequent API calls — the same contract as Kimi (#13848) and DeepSeek (#16748). Without this, multi-turn tool-use conversations through Anthropic-compatible relays fail with HTTP 400:

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

Currently, Hermes strips ALL thinking blocks for generic third-party Anthropic endpoints, only preserving them for Kimi and DeepSeek specifically. MiMo models accessed through relays fall into the generic third-party path and hit this error.

How

  • Added _MIMO_FAMILY_MODEL_PREFIXES (prefixes: mimo-, mimo_) — same pattern as _KIMI_FAMILY_MODEL_PREFIXES
  • Added _model_name_is_mimo_family() detection function
  • Extended _preserve_unsigned_thinking to include MiMo detection

Testing

  • ✅ Single-turn conversation: works
  • ✅ Multi-turn with 4 tool calls via Anthropic relay (markhub.top → MiMo): works (was HTTP 400)
  • ✅ Model detection: mimo-v2.5-pro → True, kimi-k2.5 → False, claude-sonnet-4 → False

Fixes #26774

MiMo reasoning models (mimo-v2.5-pro, etc.) require reasoning_content
(thinking blocks) to round-trip on subsequent API calls, same contract
as Kimi and DeepSeek thinking models. Without this, multi-turn tool-use
conversations through Anthropic-compatible relays fail with HTTP 400:

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

Add _model_name_is_mimo_family() detection (prefixes: mimo-, mimo_)
following the established Kimi (NousResearch#13848) and DeepSeek (NousResearch#16748) pattern,
and include it in _preserve_unsigned_thinking.

Fixes NousResearch#26774
@CallMe1101 CallMe1101 closed this May 16, 2026
@CallMe1101

Copy link
Copy Markdown
Author

sry,wait

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/xiaomi Xiaomi MiLM labels May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Xiaomi MiMo models via Anthropic-compatible relay: thinking blocks stripped causing HTTP 400

2 participants