Skip to content

feat(sse): adapt the Xiaomi MiMo call flow to its native thinking/vision contract - #4224

Merged
diegosouzapw merged 2 commits into
release/v3.8.29from
feat/mimo-flow-fixes
Jun 19, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.29from
feat/mimo-flow-fixes

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Context

Proactive doc review of Xiaomi MiMo (api.xiaomimimo.com/v1, the native xiaomi-mimo provider) — same "new model, check the call flow for param mismatches" pass we did for DeepSeek V4 / MiniMax. Focus: don't send a param extra / missing / under a different name and take a 400. MiMo's validator is strict ("400 Param Incorrect" across several upstream issues), unlike DeepSeek which ignored unknowns silently — so extra-param risk is real here.

The one documented hard 400 (replay reasoning_content on tool-call turns) was already handled (xiaomi-mimo ∈ REASONING_REPLAY_PROVIDERS). This PR closes four remaining mismatches found in the audit.

Changes

1. Thinking control → MiMo's native thinking:{type} (fix)

MiMo controls chain-of-thought only via top-level thinking:{type:"enabled"|"disabled"} and does not understand OpenAI's reasoning_effort/reasoning. OmniRoute's OpenAI path carried reasoning intent as reasoning_effort, and the claude→openai translator can leave a Claude-shaped thinking:{type, budget_tokens} — so the client's on/off choice was dropped and budget_tokens/reasoning_effort rode along as extra params a strict validator can reject.

New open-sse/services/mimoThinking.ts::normalizeMimoThinking (wired in chatCore for provider==="xiaomi-mimo"):

  • any thinking object → reduced to just {type} (disabled stays; enabled/adaptive/other → enabled),
  • reasoning_effort / reasoning → removed.

It deliberately does not synthesize thinking:{type:"enabled"} from a bare reasoning_effort — mimo-v2-omni is documented non-thinking, so forcing it on could turn a silently-ignored param into a hard error. (Inverse situation to the DeepSeek reasoning_effort tier remap in base.ts, which becomes a no-op here once reasoning_effort is removed.)

2. Vision false-positive on the *-pro chat models (fix)

Per Xiaomi's docs, only mimo-v2.5 and mimo-v2-omni accept images; the *-pro chat models are text-only. modelSpecs marked mimo-v2.5-pro/mimo-v2-pro as vision-capable, and models.dev mislabels them (hermes-agent#18884) — and resolveVisionCapability lets a synced attachment:true win first, which would route an image request to a blind model (the #4071 failure mode).

  • Corrected modelSpecs (supportsVision: false for both *-pro).
  • Added a hard override in resolveVisionCapability (checked before the synced branch) for documented text-only ids, so a wrong synced attachment:true can't win. Anchored so mimo-v2.5-pro never matches the multimodal mimo-v2.5.

3. Catalog completeness

  • Registered the missing mimo-v2-pro chat model (served via the gitlawb gateway but absent from the native provider).
  • Registered the missing mimo-v2-tts speech model in the audio registry.

Validation (TDD — Hard Rule #18)

  • New suites RED→GREEN: mimo-thinking-normalize.test.ts (9), model-capabilities-mimo-vision-override.test.ts (4 — seeds a wrong attachment:true and proves the override wins).
  • Aligned two existing tests that enshrined the wrong vision verdict (t31-…-model-specs, xiaomi-mimo-provider) — correction, not masking.
  • Adjacent regression cluster: 159/159 (provider-models-config, combo-vision-aware-routing, vision-detection-consistency, mistral-vision-sync, audio-speech-handler, reasoning-cache/replay, no-thinking-alias, …).
  • typecheck:core clean · lint 0 · check:file-size OK (chatCore baseline 5086→5095) · check:any-budget:t11 PASS · docs-sync/docs-counts PASS.

Audited but intentionally not changed (reported for the record)

  • ASR mimo-v2.5-asr is unwired (it's a custom /v1/chat/completions + input_audio + asr_options call, not OpenAI /v1/audio/transcriptions). Wiring it is a standalone feature, out of scope here.
  • max_tokens vs max_completion_tokens: MiMo's docs canonicalize max_completion_tokens but no evidence it rejects max_tokens; left as a watch-item (renaming blindly is riskier than the status quo).
  • temperature range [0,1.5] (vs OpenAI [0,2]): a client sending an extreme value could 400, but per-provider clamping is invasive — left as a watch-item.
  • Tool-call message shape (XiaomiMiMo/MiMo#44): an upstream-acknowledged, unresolved strict-validation bug — not safely patchable speculatively.

…ion contract

Proactive review of the Xiaomi MiMo (api.xiaomimimo.com) API docs surfaced
four call-flow mismatches against OmniRoute's request pipeline:

- thinking control: MiMo controls reasoning ONLY via thinking:{type:"enabled"|
  "disabled"} and rejects unknown/extra params (strict "400 Param Incorrect").
  New open-sse/services/mimoThinking.ts normalizes the OpenAI path onto that
  native shape — reduces any thinking object to {type}, drops reasoning_effort/
  reasoning — wired in chatCore for provider==="xiaomi-mimo". It deliberately
  does NOT synthesize thinking from a bare reasoning_effort (mimo-v2-omni is
  non-thinking, so that could turn a silently-ignored param into a hard error).

- vision: only mimo-v2.5 and mimo-v2-omni accept images; the *-pro chat models
  are text-only. modelSpecs marked mimo-v2.5-pro/mimo-v2-pro vision-capable and
  models.dev mislabels them (hermes-agent#18884). Corrected the specs AND added
  a hard override in resolveVisionCapability that beats a wrong synced
  attachment:true (the #4071 failure mode: an image routed to a blind model).

- catalog: registered the missing mimo-v2-pro chat model (served via the
  gitlawb gateway but absent from the native provider) and the missing
  mimo-v2-tts speech model.

TDD: new unit suites for normalizeMimoThinking and the vision override
(RED->GREEN); aligned two existing tests that enshrined the wrong vision
verdict. typecheck:core / lint / file-size / any-budget:t11 all green.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 0e95c45 into release/v3.8.29 Jun 19, 2026
4 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 19, 2026
@diegosouzapw
diegosouzapw deleted the feat/mimo-flow-fixes branch June 19, 2026 12:06
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…ion contract (cheaper-inference#4224)

Integrated into release/v3.8.29 (Xiaomi MiMo native thinking/vision contract; baseline chatCore.ts 5086->5095).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant