openclaw - 💡(How to fix) Fix feat: Support reasoning_content for Anthropic-compatible endpoints (MiMo, etc.) [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#81261Fetched 2026-05-14 03:33:58
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
cross-referenced ×2commented ×1

Error Message

  1. MiMo expects it → returns 400 error

Fix Action

Fix / Workaround

Current Workaround

A similar workaround can be applied for MiMo by adding xiaomi to isMinimaxAnthropicMessagesModel, but this also disables thinking.

  • MiniMax workaround: src/agents/pi-embedded-runner/minimax-stream-wrappers.ts
  • OpenAI transport handling: openai-transport-stream lines ~1985-1998
  • Pi-ai Anthropic provider: @mariozechner/pi-ai/dist/providers/anthropic.js

Code Example

{"delta": {"content": "", "reasoning_content": "Let me think..."}}
RAW_BUFFERClick to expand / collapse

Problem

Some Anthropic-compatible endpoints (like Xiaomi MiMo and MiniMax) return reasoning_content in OpenAI-style delta chunks instead of native Anthropic thinking blocks:

{"delta": {"content": "", "reasoning_content": "Let me think..."}}

Pi-ai's Anthropic provider only handles native Anthropic thinking block events (content_block_start with type: "thinking", content_block_delta with type: "thinking_delta"), so reasoning_content is ignored and leaks as visible text.

When thinking mode is enabled, this causes a cascade failure:

  1. MiMo returns reasoning_content → pi-ai ignores it (leaks as text)
  2. Next message: OpenClaw doesn't send reasoning_content back
  3. MiMo expects it → returns 400 error
  4. Fallback to other providers also fails → session completely broken

Current Workaround

MiniMax has the same issue. The current fix in proxy-stream-wrappers is createMinimaxThinkingDisabledWrapper which forces thinking: {type: "disabled"} in the payload. This prevents crashes but disables thinking entirely.

A similar workaround can be applied for MiMo by adding xiaomi to isMinimaxAnthropicMessagesModel, but this also disables thinking.

Proposed Fix

To properly support thinking for these endpoints, the Anthropic stream processing needs to:

  1. Detect reasoning_content in SSE delta events (like the OpenAI transport already does in lines ~1985-1998 of openai-transport-stream)
  2. Convert to thinking blocks so pi-ai can process them natively
  3. Replay reasoning_content in subsequent assistant messages so the model can reference its previous reasoning

This likely requires changes in:

  • @mariozechner/pi-ai Anthropic provider (providers/anthropic.js) - SSE event handling
  • OpenClaw's message construction - replay reasoning_content in assistant messages

Affected Providers

  • Xiaomi MiMo (provider: "xiaomi", api: "anthropic-messages")
  • MiniMax (provider: "minimax", api: "anthropic-messages") - currently disabled
  • Any other Anthropic-compatible endpoint that returns reasoning_content in OpenAI format

References

  • MiniMax workaround: src/agents/pi-embedded-runner/minimax-stream-wrappers.ts
  • OpenAI transport handling: openai-transport-stream lines ~1985-1998
  • Pi-ai Anthropic provider: @mariozechner/pi-ai/dist/providers/anthropic.js

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