mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
This builds the model catalog from per-provider definitions and models.dev v2 data. It eplacer `generate-models.ts` with one `defineProvider()` file per built-in provider, shared model-family rules (Claude, GPT, DeepSeek, Kimi, Google), and source adapters. models.dev is read through its v2 API. Outputs and CLI flags are unchanged.
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import type { Model } from "../../src/types.ts";
|
|
import { defineProvider, modelsDevModels, type ProviderContext } from "../define.ts";
|
|
|
|
/**
|
|
* Xiaomi MiMo. The `xiaomi` provider targets the API billing endpoint; the
|
|
* `xiaomi-token-plan-*` providers cover prepaid Token Plan endpoints per region.
|
|
* MiMo Chat Completions only documents thinking.type enabled/disabled and
|
|
* rejects some reasoning_effort values (e.g. "minimal"). Xiaomi documents all
|
|
* effort levels as identical, so expose only off and high.
|
|
*/
|
|
export function xiaomiModels(ctx: ProviderContext, baseUrl: string) {
|
|
return modelsDevModels(ctx, ctx.providerId, {
|
|
api: "openai-completions",
|
|
baseUrl,
|
|
skipDeprecated: true,
|
|
recordReasoning: false,
|
|
compat: {
|
|
supportsReasoningEffort: false,
|
|
requiresReasoningContentOnAssistantMessages: true,
|
|
thinkingFormat: "deepseek",
|
|
},
|
|
map: (model): Model<"openai-completions"> =>
|
|
model.reasoning
|
|
? {
|
|
...model,
|
|
thinkingLevelMap: {
|
|
off: "off",
|
|
minimal: null,
|
|
low: null,
|
|
medium: null,
|
|
high: "high",
|
|
xhigh: null,
|
|
max: null,
|
|
},
|
|
}
|
|
: model,
|
|
});
|
|
}
|
|
|
|
export const XIAOMI_COMPLETIONS_COMPAT = { supportsStrictMode: true } as const;
|
|
|
|
export default defineProvider({
|
|
id: "xiaomi",
|
|
models: (ctx) => xiaomiModels(ctx, "https://api.xiaomimimo.com/v1"),
|
|
compat: { "openai-completions": XIAOMI_COMPLETIONS_COMPAT },
|
|
});
|