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.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { addMissing, defineProvider, modelsDevModels } from "../define.ts";
|
|
import { getEffortThinkingLevelMap } from "../reasoning.ts";
|
|
import { roundCost } from "../sources/models-dev.ts";
|
|
|
|
export default defineProvider({
|
|
id: "mistral",
|
|
models: (ctx) =>
|
|
addMissing(
|
|
modelsDevModels(ctx, "mistral", {
|
|
api: "mistral-conversations",
|
|
baseUrl: "https://api.mistral.ai",
|
|
recordReasoning: false,
|
|
map: (model, source) => {
|
|
// Models with effort values use `reasoning_effort` with these levels.
|
|
// Reasoning models without them (Magistral) use `prompt_mode`.
|
|
const thinkingLevelMap = getEffortThinkingLevelMap(source.reasoningOptions ?? []);
|
|
return {
|
|
...model,
|
|
...(thinkingLevelMap ? { thinkingLevelMap } : {}),
|
|
cost: {
|
|
input: source.cost.input || 0,
|
|
output: source.cost.output || 0,
|
|
// Mistral bills cached input at 10% when models.dev does not say otherwise.
|
|
cacheRead: source.cost.cacheRead ?? (source.cost.input ? roundCost(source.cost.input * 0.1) : 0),
|
|
cacheWrite: source.cost.cacheWrite || 0,
|
|
},
|
|
};
|
|
},
|
|
}),
|
|
[
|
|
{
|
|
id: "mistral-medium-3.5",
|
|
name: "Mistral Medium 3.5",
|
|
api: "mistral-conversations",
|
|
provider: "mistral",
|
|
baseUrl: "https://api.mistral.ai",
|
|
reasoning: true,
|
|
thinkingLevelMap: getEffortThinkingLevelMap([{ type: "effort", values: ["none", "high"] }]),
|
|
input: ["text", "image"],
|
|
cost: { input: 1.5, output: 7.5, cacheRead: 0, cacheWrite: 0 },
|
|
contextWindow: 262144,
|
|
maxTokens: 262144,
|
|
},
|
|
],
|
|
),
|
|
});
|