Skip to content

fix(xiaomi): pass thinking param to MiMo API - #27363

Open
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:fix/mimo-thinking-param-27325
Open

fix(xiaomi): pass thinking param to MiMo API#27363
zccyman wants to merge 1 commit into
NousResearch:mainfrom
atyou2happy:fix/mimo-thinking-param-27325

Conversation

@zccyman

@zccyman zccyman commented May 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a custom Xiaomi provider profile class that emits extra_body.thinking to control MiMo thinking mode. When the user configures reasoning_effort: none or otherwise disables reasoning, sends thinking: {type: "disabled"} to prevent unnecessary token consumption.

Closes #27325

Problem

Xiaomi MiMo provider used a bare ProviderProfile with no overrides — the thinking parameter was never passed in API requests. MiMo defaults to thinking=enabled, consuming tokens on every request regardless of user config. Settings like reasoning_effort: none had no effect on the actual API call.

Solution

Replace the bare ProviderProfile with a XiaomiProfile subclass that overrides build_api_kwargs_extras, following the same pattern used by KimiProfile:

  • When reasoning_config.enabled is Falseextra_body.thinking = {type: "disabled"}
  • Otherwise → extra_body.thinking = {type: "enabled"}

Only 1 file changed (+45/-2).

Files Changed

# File Change
1 plugins/model-providers/xiaomi/__init__.py +45/-2: add XiaomiProfile class with build_api_kwargs_extras override for thinking param

Test Results

94 passed (related provider profile + Xiaomi tests)
0 regressions

Design Decisions

  • Follows Kimi pattern exactly — Kimi already uses the same extra_body.thinking approach via KimiProfile.build_api_kwargs_extras. Xiaomi uses the same OpenAI-compatible API format.
  • Minimal diff — no changes to transport, no new params, no legacy path changes. Only the provider profile needed updating.

@cardtest15-coder

This comment was marked as spam.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins provider/xiaomi Xiaomi MiLM labels May 17, 2026
@zccyman
zccyman force-pushed the fix/mimo-thinking-param-27325 branch from ca2d16a to fe750d9 Compare May 18, 2026 00:36
@teknium1

teknium1 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for the focused Xiaomi provider fix. The premise remains valid on current main: plugins/model-providers/xiaomi/__init__.py:6 still creates a bare ProviderProfile, while agent/transports/chat_completions.py:580-611 invokes and merges profile-specific API extras.

Problems

  • The implementation only disables thinking for reasoning_config["enabled"] is False. agent/agent_init.py:381 documents { "effort": "none" } as a disabling configuration, but this PR would default enabled to true and emit enabled thinking for that input.
  • gh pr diff 27363 shows no Xiaomi tests. The repository has analogous Kimi profile coverage at tests/providers/test_provider_profiles.py:78-82 and transport coverage at tests/providers/test_profile_wiring.py:77-91.

Suggested changes

  • Treat normalized effort == "none" as disabled alongside enabled is False.
  • Add direct Xiaomi-profile and profile-path transport regression tests for both disable forms.

This is an automated hermes-sweeper review.

teknium1 added a commit that referenced this pull request Jun 15, 2026
Salvages the Xiaomi MiMo thinking/replay fixes from #27886/#25379/#26802/#27363 into one provider cluster, with MiMo reasoning replay enabled for native Xiaomi endpoints plus Nous/OpenRouter Xiaomi slugs.

Co-authored-by: EloquentBrush0x <283442588+EloquentBrush0x@users.noreply.github.com>

Co-authored-by: Peterson <pppan2003@gmail.com>

Co-authored-by: Zhao Zhuoran <zhao.zr11@protonmail.com>

Co-authored-by: zccyman <zccyman@users.noreply.github.com>
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 13, 2026
jh1nresh pushed a commit to jh1nresh/hermes-agent that referenced this pull request Aug 26, 2026
Salvages the Xiaomi MiMo thinking/replay fixes from NousResearch#27886/NousResearch#25379/NousResearch#26802/NousResearch#27363 into one provider cluster, with MiMo reasoning replay enabled for native Xiaomi endpoints plus Nous/OpenRouter Xiaomi slugs.

Co-authored-by: EloquentBrush0x <283442588+EloquentBrush0x@users.noreply.github.com>

Co-authored-by: Peterson <pppan2003@gmail.com>

Co-authored-by: Zhao Zhuoran <zhao.zr11@protonmail.com>

Co-authored-by: zccyman <zccyman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/xiaomi Xiaomi MiLM sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Xiaomi MiMo provider does not pass thinking parameter — defaults to thinking-enabled, wasting tokens

4 participants