Skip to content

Commit 1c4bda2

Browse files
committed
Drop Xiaomi ASR models from catalog
1 parent 7bbe2d8 commit 1c4bda2

4 files changed

Lines changed: 44 additions & 20 deletions

File tree

packages/catalog/scripts/generate-models.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,19 @@ function dropFireworksWireIds(models: readonly ModelSpec[]): ModelSpec[] {
307307
);
308308
}
309309

310+
/**
311+
* Xiaomi's `/v1/models` can advertise ASR/TTS ids alongside chat/completions
312+
* models. Runtime discovery filters them, but previous bundled snapshots can
313+
* still resurrect those stale ids via the fallback merge. Drop them here so the
314+
* committed catalog matches the runtime surface.
315+
*/
316+
function dropXiaomiAudioOnlyIds(models: readonly ModelSpec[]): ModelSpec[] {
317+
return models.filter(model => {
318+
const isXiaomiProvider = model.provider === "xiaomi" || model.provider.startsWith("xiaomi-token-plan-");
319+
return !isXiaomiProvider || (!model.id.includes("-tts") && !model.id.includes("-asr"));
320+
});
321+
}
322+
310323
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
311324

312325
async function getOAuthAccessFromStorage(provider: OAuthProvider): Promise<OAuthAccess | null> {
@@ -496,6 +509,7 @@ async function generateModels() {
496509
allModels = applyFireworksDeepSeekReasoningShape(allModels);
497510
allModels = dropFireworksWireIds(allModels);
498511
allModels = dropUnusableZaiContextTierIds(allModels);
512+
allModels = dropXiaomiAudioOnlyIds(allModels);
499513
// Normalize display names: gateway author prefixes ("OpenAI: …"), alias
500514
// markers ("(latest)"), provider attribution ("(Antigravity)"), and
501515
// price/promo tags are model-extrinsic — strip them from the bundle.

packages/catalog/src/models.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78345,25 +78345,6 @@
7834578345
]
7834678346
}
7834778347
},
78348-
"mimo-v2.5-asr": {
78349-
"id": "mimo-v2.5-asr",
78350-
"name": "mimo-v2.5-asr",
78351-
"api": "openai-completions",
78352-
"provider": "xiaomi",
78353-
"baseUrl": "https://api.xiaomimimo.com/v1",
78354-
"reasoning": false,
78355-
"input": [
78356-
"text"
78357-
],
78358-
"cost": {
78359-
"input": 0,
78360-
"output": 0,
78361-
"cacheRead": 0,
78362-
"cacheWrite": 0
78363-
},
78364-
"contextWindow": null,
78365-
"maxTokens": null
78366-
},
7836778348
"mimo-v2.5-pro": {
7836878349
"id": "mimo-v2.5-pro",
7836978350
"name": "MiMo-V2.5-Pro",

packages/catalog/src/provider-models/openai-compat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2456,7 +2456,7 @@ export function xiaomiModelManagerOptions(
24562456
provider: providerId,
24572457
baseUrl: url,
24582458
apiKey,
2459-
filterModel: (_entry, model) => !model.id.includes("-tts"),
2459+
filterModel: (_entry, model) => !model.id.includes("-tts") && !model.id.includes("-asr"),
24602460
mapModel: (entry, defaults) => {
24612461
const reference = references.get(defaults.id);
24622462
const model = mapWithBundledReference(entry, defaults, reference);

packages/catalog/test/issue-772-repro.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, expect, it } from "bun:test";
22
import { loginXiaomi } from "@oh-my-pi/pi-ai/registry/oauth/xiaomi";
33
import { xiaomiModelManagerOptions } from "@oh-my-pi/pi-catalog/provider-models/openai-compat";
44
import type { FetchImpl } from "@oh-my-pi/pi-catalog/types";
5+
import modelsJson from "../src/models.json";
56

67
const TOKEN_PLAN_SGP_HOST = "token-plan-sgp.xiaomimimo.com";
78
const STANDARD_HOST = "api.xiaomimimo.com";
@@ -64,4 +65,32 @@ describe("issue-772: Xiaomi MiMo token-plan (tp-) keys", () => {
6465
expect(url).toContain(STANDARD_HOST);
6566
expect(url).not.toContain(TOKEN_PLAN_SGP_HOST);
6667
});
68+
69+
it("filters Xiaomi ASR and TTS-only models from discovery", async () => {
70+
const fetchMock: FetchImpl = async () =>
71+
new Response(
72+
JSON.stringify({
73+
data: [
74+
{ id: "mimo-v2.5-asr", name: "mimo-v2.5-asr" },
75+
{ id: "mimo-v2.5-tts", name: "mimo-v2.5-tts" },
76+
{ id: "mimo-v2.5", name: "MiMo-V2.5" },
77+
],
78+
}),
79+
{
80+
status: 200,
81+
headers: { "content-type": "application/json" },
82+
},
83+
);
84+
85+
const models = await xiaomiModelManagerOptions({
86+
apiKey: "sk-test-key",
87+
fetch: fetchMock,
88+
}).fetchDynamicModels?.();
89+
90+
expect(models?.map(model => model.id)).toEqual(["mimo-v2.5"]);
91+
});
92+
93+
it("does not bundle Xiaomi ASR-only models", () => {
94+
expect(Object.keys(modelsJson.xiaomi)).not.toContain("mimo-v2.5-asr");
95+
});
6796
});

0 commit comments

Comments
 (0)