pi-mono/packages/ai/catalog/providers/minimax.ts
Armin Ronacher 2e0f175bd5
feat(ai): refactor provider definitions (#11368)
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.
2026-10-28 11:06:10 +01:00

26 lines
1.2 KiB
TypeScript

import { defineProvider, modelsDevModels, type ProviderContext } from "../define.ts";
import { getEffortThinkingLevelMap } from "../reasoning.ts";
// MiniMax asked to hide older models from its direct providers (#2596).
const HIDDEN_MODEL_IDS = new Set(["MiniMax-M2", "MiniMax-M2.1", "MiniMax-M2.5", "MiniMax-M2.5-highspeed"]);
/** MiniMax's Anthropic-compatible API. The SDK appends /v1/messages. */
export function minimaxModels(ctx: ProviderContext, source: string, baseUrl: string) {
return modelsDevModels(ctx, source, {
api: "anthropic-messages",
baseUrl,
recordReasoning: false,
include: (model) => !HIDDEN_MODEL_IDS.has(model.id),
map: (model, source) => {
// Models with effort levels (e.g. MiniMax-M3.1-Flash) take adaptive thinking with
// output_config.effort and reject thinking.type="disabled" (no "none" effort, so off is null).
const thinkingLevelMap = getEffortThinkingLevelMap(source.reasoningOptions ?? []);
return thinkingLevelMap ? { ...model, thinkingLevelMap, compat: { forceAdaptiveThinking: true } } : model;
},
});
}
export default defineProvider({
id: "minimax",
models: (ctx) => minimaxModels(ctx, "minimax", "https://api.minimax.io/anthropic"),
});