Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions packages/pi-ai/scripts/generate-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,15 @@ function applyThinkingLevelMetadata(model: Model<any>): void {
) {
mergeAnthropicMessagesCompat(model, { forceAdaptiveThinking: true });
}
if (
(model.provider === "minimax" || model.provider === "minimax-cn") &&
model.api === "anthropic-messages" &&
model.id === "MiniMax-M3"
) {
// M3 exposes adaptive and disabled thinking modes over the Anthropic-compatible
// endpoint, so force adaptive thinking instead of the budget-based default.
mergeAnthropicMessagesCompat(model, { forceAdaptiveThinking: true });
}
if (model.api === "openai-completions" && model.id.includes("deepseek-v4")) {
mergeThinkingLevelMap(model, DEEPSEEK_V4_THINKING_LEVEL_MAP);
}
Expand Down Expand Up @@ -1786,12 +1795,16 @@ async function generateModels() {
}
}

const minimaxDirectModelOverrides = new Map([
const minimaxDirectModelOverrides = new Map<
string,
{ contextWindow: number; maxTokens: number; input?: ("text" | "image" | "video")[] }
>([
["MiniMax-M2.7", { contextWindow: 204800, maxTokens: 131072 }],
["MiniMax-M2.7-highspeed", { contextWindow: 204800, maxTokens: 131072 }],
// MiniMax's API overview advertises a 1M context window for M3; models.dev
// currently reports the documented guaranteed 512K floor.
["MiniMax-M3", { contextWindow: 1000000, maxTokens: 131072 }],
// currently reports the documented guaranteed 512K floor. M3 also accepts
// video inputs alongside text and image, which models.dev does not report.
["MiniMax-M3", { contextWindow: 1000000, maxTokens: 131072, input: ["text", "image", "video"] }],
]);
const minimaxDirectSupportedIds = new Set(minimaxDirectModelOverrides.keys());

Expand All @@ -1804,6 +1817,9 @@ async function generateModels() {
if (override) {
candidate.contextWindow = override.contextWindow;
candidate.maxTokens = override.maxTokens;
if (override.input) {
candidate.input = override.input;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/pi-ai/src/model-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const ModelCatalogEntrySchema = Type.Object({
baseUrl: Type.String(),
reasoning: Type.Boolean(),
thinkingLevelMap: Type.Optional(ThinkingLevelMapSchema),
input: Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image")]), { minItems: 1 }),
input: Type.Array(Type.Union([Type.Literal("text"), Type.Literal("image"), Type.Literal("video")]), { minItems: 1 }),
cost: Type.Object({
input: Type.Number(),
output: Type.Number(),
Expand Down
12 changes: 10 additions & 2 deletions packages/pi-ai/src/models.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -7694,10 +7694,14 @@
"api": "anthropic-messages",
"provider": "minimax",
"baseUrl": "https://api.minimax.io/anthropic",
"compat": {
"forceAdaptiveThinking": true
},
"reasoning": true,
"input": [
"text",
"image"
"image",
"video"
],
"cost": {
"input": 0.6,
Expand Down Expand Up @@ -7754,10 +7758,14 @@
"api": "anthropic-messages",
"provider": "minimax-cn",
"baseUrl": "https://api.minimaxi.com/anthropic",
"compat": {
"forceAdaptiveThinking": true
},
"reasoning": true,
"input": [
"text",
"image"
"image",
"video"
],
"cost": {
"input": 0.6,
Expand Down
6 changes: 4 additions & 2 deletions packages/pi-ai/src/models.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6132,8 +6132,9 @@ export const MODELS = {
api: "anthropic-messages",
provider: "minimax",
baseUrl: "https://api.minimax.io/anthropic",
compat: {"forceAdaptiveThinking":true},
reasoning: true,
input: ["text", "image"],
input: ["text", "image", "video"],
cost: {
input: 0.6,
output: 2.4,
Expand Down Expand Up @@ -6185,8 +6186,9 @@ export const MODELS = {
api: "anthropic-messages",
provider: "minimax-cn",
baseUrl: "https://api.minimaxi.com/anthropic",
compat: {"forceAdaptiveThinking":true},
reasoning: true,
input: ["text", "image"],
input: ["text", "image", "video"],
cost: {
input: 0.6,
output: 2.4,
Expand Down
2 changes: 1 addition & 1 deletion packages/pi-ai/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ export interface Model<TApi extends Api> {
* Missing keys use provider defaults. null marks a level as unsupported.
*/
thinkingLevelMap?: ThinkingLevelMap;
input: ("text" | "image")[];
input: ("text" | "image" | "video")[];
cost: {
input: number; // $/million tokens
output: number; // $/million tokens
Expand Down
3 changes: 2 additions & 1 deletion packages/pi-ai/test/generated-models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ describe("models.generated.ts", () => {
provider,
baseUrl,
reasoning: true,
input: ["text", "image"],
input: ["text", "image", "video"],
compat: { forceAdaptiveThinking: true },
cost: {
input: 0.6,
output: 2.4,
Expand Down
2 changes: 1 addition & 1 deletion packages/pi-coding-agent/src/core/model-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ export class ModelRegistry {
private getDiscoveryProviderDefaults(provider: string): {
api: Api;
baseUrl: string;
input: ("text" | "image")[];
input: Model<Api>["input"];
contextWindow: number;
maxTokens: number;
} {
Expand Down
Loading