Repository navigation
feat(sse): adapt the Xiaomi MiMo call flow to its native thinking/vision contract - #4224
Merged
Merged
Conversation
…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.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Merged
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Proactive doc review of Xiaomi MiMo (
api.xiaomimimo.com/v1, the nativexiaomi-mimoprovider) — 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 a400. 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_contenton 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'sreasoning_effort/reasoning. OmniRoute's OpenAI path carried reasoning intent asreasoning_effort, and the claude→openai translator can leave a Claude-shapedthinking:{type, budget_tokens}— so the client's on/off choice was dropped andbudget_tokens/reasoning_effortrode along as extra params a strict validator can reject.New
open-sse/services/mimoThinking.ts::normalizeMimoThinking(wired inchatCoreforprovider==="xiaomi-mimo"):thinkingobject → reduced to just{type}(disabledstays;enabled/adaptive/other →enabled),reasoning_effort/reasoning→ removed.It deliberately does not synthesize
thinking:{type:"enabled"}from a barereasoning_effort—mimo-v2-omniis documented non-thinking, so forcing it on could turn a silently-ignored param into a hard error. (Inverse situation to the DeepSeekreasoning_efforttier remap inbase.ts, which becomes a no-op here oncereasoning_effortis removed.)2. Vision false-positive on the
*-prochat models (fix)Per Xiaomi's docs, only
mimo-v2.5andmimo-v2-omniaccept images; the*-prochat models are text-only.modelSpecsmarkedmimo-v2.5-pro/mimo-v2-proas vision-capable, and models.dev mislabels them (hermes-agent#18884) — andresolveVisionCapabilitylets a syncedattachment:truewin first, which would route an image request to a blind model (the #4071 failure mode).modelSpecs(supportsVision: falsefor both*-pro).resolveVisionCapability(checked before the synced branch) for documented text-only ids, so a wrong syncedattachment:truecan't win. Anchored somimo-v2.5-pronever matches the multimodalmimo-v2.5.3. Catalog completeness
mimo-v2-prochat model (served via thegitlawbgateway but absent from the native provider).mimo-v2-ttsspeech model in the audio registry.Validation (TDD — Hard Rule #18)
mimo-thinking-normalize.test.ts(9),model-capabilities-mimo-vision-override.test.ts(4 — seeds a wrongattachment:trueand proves the override wins).t31-…-model-specs,xiaomi-mimo-provider) — correction, not masking.typecheck:coreclean ·lint0 ·check:file-sizeOK (chatCore baseline 5086→5095) ·check:any-budget:t11PASS ·docs-sync/docs-countsPASS.Audited but intentionally not changed (reported for the record)
mimo-v2.5-asris unwired (it's a custom/v1/chat/completions+input_audio+asr_optionscall, not OpenAI/v1/audio/transcriptions). Wiring it is a standalone feature, out of scope here.max_tokensvsmax_completion_tokens: MiMo's docs canonicalizemax_completion_tokensbut no evidence it rejectsmax_tokens; left as a watch-item (renaming blindly is riskier than the status quo).temperaturerange[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.