Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(reasoning-cache): include xiaomi-mimo in replay provider/model detection (#2198)

Antonb23b624f82a2
diff --git a/open-sse/services/reasoningCache.ts b/open-sse/services/reasoningCache.ts
index 2b5f7788e3..95da644d27 100644
--- a/open-sse/services/reasoningCache.ts
+++ b/open-sse/services/reasoningCache.ts
@@ -34,6 +34,11 @@ const REASONING_REPLAY_PROVIDERS = new Set([
"sambanova",
"fireworks",
"together",
+ // Xiaomi MiMo enforces the same "pass back reasoning_content on subsequent
+ // turns" contract as DeepSeek/Kimi-thinking. Without replay the upstream
+ // 400s with "Param Incorrect: The reasoning_content in the thinking mode
+ // must be passed back to the API."
+ "xiaomi-mimo",
]);
const REASONING_REPLAY_MODEL_PATTERNS = [
@@ -44,6 +49,9 @@ const REASONING_REPLAY_MODEL_PATTERNS = [
/qwq/i,
/qwen.*think/i,
/glm.*think/i,
+ // MiMo (Xiaomi) thinking models — defensive match if a wildcard route
+ // assigns a non-`xiaomi-mimo` provider ID to a mimo-* model alias.
+ /^mimo[-.]?v\d/i,
];
/**
diff --git a/tests/unit/reasoning-cache.test.ts b/tests/unit/reasoning-cache.test.ts
index b2dcf6d496..7fa835239f 100644
--- a/tests/unit/reasoning-cache.test.ts
+++ b/tests/unit/reasoning-cache.test.ts
@@ -346,6 +346,20 @@ describe("Reasoning Replay Cache — Provider Detection", () => {
assert.equal(requiresReasoningReplay("glm", "glm-5-thinking"), true);
});
+ it("should detect xiaomi-mimo provider", () => {
+ // MiMo enforces reasoning_content echo on subsequent turns; without
+ // replay the upstream returns 400 "Param Incorrect: The reasoning_content
+ // in the thinking mode must be passed back to the API."
+ assert.equal(requiresReasoningReplay("xiaomi-mimo", "mimo-v2.5-pro"), true);
+ assert.equal(requiresReasoningReplay("XIAOMI-MIMO", "mimo-v2.5"), true);
+ });
+
+ it("should detect mimo-v* model pattern under any provider id", () => {
+ assert.equal(requiresReasoningReplay("unknown-provider", "mimo-v2.5-pro"), true);
+ assert.equal(requiresReasoningReplay("unknown-provider", "mimo-v3"), true);
+ assert.equal(requiresReasoningReplay("unknown-provider", "MimoV2.5-pro"), true);
+ });
+
it("should NOT detect a generic openai model", () => {
assert.equal(requiresReasoningReplay("openai", "gpt-4o"), false);
});