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.
29 lines
855 B
TypeScript
29 lines
855 B
TypeScript
import { defineProvider, mergeThinking, modelsDevModels } from "../define.ts";
|
|
|
|
// Retired or unsuitable for pi's built-in catalog.
|
|
const EXCLUDED_MODEL_IDS = new Set([
|
|
"grok-3",
|
|
"grok-3-fast",
|
|
"grok-4.20-0309-non-reasoning",
|
|
"grok-4.20-0309-reasoning",
|
|
"grok-build-0.1",
|
|
"grok-code-fast-1",
|
|
]);
|
|
|
|
export default defineProvider({
|
|
id: "xai",
|
|
models: (ctx) =>
|
|
modelsDevModels(ctx, "xai", {
|
|
api: "openai-responses",
|
|
baseUrl: "https://api.x.ai/v1",
|
|
compat: { supportsLongCacheRetention: false },
|
|
include: (source) => !EXCLUDED_MODEL_IDS.has(source.id),
|
|
}),
|
|
finalize: (model) => {
|
|
// Models without verified effort options must not send the undocumented
|
|
// "none"/"minimal" efforts.
|
|
if (model.api === "openai-responses" && model.thinkingLevelMap === undefined) {
|
|
mergeThinking(model, { off: null, minimal: null });
|
|
}
|
|
},
|
|
});
|