Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

đź’„ style: Add new MiniMax-M3 model (#15403)

sxjerudd2e32cf6f85
diff --git a/packages/model-bank/src/aiModels/minimax.ts b/packages/model-bank/src/aiModels/minimax.ts
index d41ee9d3516..99059e6440d 100644
--- a/packages/model-bank/src/aiModels/minimax.ts
+++ b/packages/model-bank/src/aiModels/minimax.ts
@@ -5,6 +5,59 @@ import {
} from '../types/aiModel';
const minimaxChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ video: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_000_000,
+ description:
+ 'Frontier coding model with native multimodal input, 1M context, and strong agent capabilities.',
+ displayName: 'MiniMax M3',
+ enabled: true,
+ id: 'MiniMax-M3',
+ maxOutput: 524_288,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ {
+ name: 'textInput',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 4.2, upTo: 512_000 },
+ { rate: 8.4, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textOutput',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 16.8, upTo: 512_000 },
+ { rate: 33.6, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textInput_cacheRead',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 0.84, upTo: 512_000 },
+ { rate: 1.68, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ { name: 'textInput_cacheWrite', rate: 2.625, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2026-06-01',
+ settings: {
+ extendParams: ['enableReasoning'],
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -14,7 +67,6 @@ const minimaxChatModels: AIChatModelCard[] = [
description:
'First self-evolving model with top-tier coding and agentic performance (~60 tps).',
displayName: 'MiniMax M2.7',
- enabled: true,
id: 'MiniMax-M2.7',
maxOutput: 131_072,
pricing: {
@@ -360,7 +412,6 @@ const minimaxVideoModels: AIVideoModelCard[] = [
description:
'The next-generation video generation model, MiniMax Hailuo 02, has been officially released, supporting 1080P resolution and 10-second video generation.',
displayName: 'MiniMax Hailuo 02',
- enabled: true,
id: 'MiniMax-Hailuo-02',
parameters: {
duration: { default: 6, enum: [6, 10] },
diff --git a/packages/model-bank/src/aiModels/xiaomimimo.ts b/packages/model-bank/src/aiModels/xiaomimimo.ts
index 0bdf80012f4..07c2615f092 100644
--- a/packages/model-bank/src/aiModels/xiaomimimo.ts
+++ b/packages/model-bank/src/aiModels/xiaomimimo.ts
@@ -109,88 +109,6 @@ const xiaomimimoChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'MiMo-V2-Pro is specifically designed for high-intensity agent workflows in real-world scenarios. It features over 1 trillion total parameters (42B activated parameters), adopts an innovative hybrid attention architecture, and supports an ultra-long context length of up to 1 million tokens. Built on a powerful foundational model, we continuously scale computational resources across a broader range of agent scenarios, further expanding the action space of intelligence and achieving significant generalization—from coding to real-world task execution (“claw”).',
- displayName: 'MiMo-V2 Pro',
- id: 'mimo-v2-pro',
- maxOutput: 131_072,
- pricing: {
- currency: 'CNY',
- units: [
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 1.4, upTo: 0.256 },
- { rate: 2.8, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 7, upTo: 0.256 },
- { rate: 14, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 21, upTo: 0.256 },
- { rate: 42, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['enableReasoning'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'MiMo-V2-Omni is purpose-built for complex multimodal interaction and execution scenarios in the real world. We constructed a full-modality foundation from the ground up, integrating text, vision, and speech, and unified “perception” and “action” within a single architecture. This not only breaks the traditional limitation of models that emphasize understanding over execution, but also endows the model with native capabilities in multimodal perception, tool usage, function execution, and GUI operations. MiMo-V2-Omni can seamlessly integrate with major agent frameworks, achieving a leap from understanding to control while significantly lowering the barrier to deploying fully multimodal agents.',
- displayName: 'MiMo-V2 Omni',
- id: 'mimo-v2-omni',
- maxOutput: 131_072,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 2.8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 14, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['enableReasoning'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts b/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
index a44c4d7796f..63336a77fd6 100644
--- a/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
+++ b/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
@@ -4,6 +4,7 @@ import anthropicChatModels from 'model-bank/anthropic';
import azureChatModels from 'model-bank/azure';
import deepseekChatModels from 'model-bank/deepseek';
import googleChatModels from 'model-bank/google';
+import minimaxChatModels from 'model-bank/minimax';
import openaiChatModels from 'model-bank/openai';
import vertexAiModels from 'model-bank/vertexai';
import { describe, expect, it } from 'vitest';
@@ -804,6 +805,75 @@ describe('computeChatPricing', () => {
});
});
+ describe('MiniMax', () => {
+ it('uses total input tokens to select tiered rates for MiniMax-M3', () => {
+ const pricing = minimaxChatModels.find(
+ (model: { id: string }) => model.id === 'MiniMax-M3',
+ )?.pricing;
+ expect(pricing).toBeDefined();
+
+ // Lower tier test (<= 512,000 tokens)
+ const usage1: ModelTokensUsage = {
+ inputCacheMissTokens: 100_000,
+ inputCachedTokens: 20_000,
+ inputTextTokens: 120_000,
+ outputTextTokens: 10_000,
+ totalInputTokens: 120_000,
+ totalOutputTokens: 10_000,
+ totalTokens: 130_000,
+ };
+
+ const result1 = computeChatCost(pricing, usage1);
+ expect(result1).toBeDefined();
+ expect(result1?.issues).toHaveLength(0);
+
+ const input1 = result1?.breakdown.find((item) => item.unit.name === 'textInput');
+ expect(input1?.quantity).toBe(100_000);
+ expect(input1?.credits).toBe(58_989); // Math.ceil((100,000 * 4.2) / 7.12)
+ expect(input1?.segments).toEqual([{ quantity: 100_000, rate: 4.2, credits: 420_000 }]);
+
+ const cached1 = result1?.breakdown.find((item) => item.unit.name === 'textInput_cacheRead');
+ expect(cached1?.quantity).toBe(20_000);
+ expect(cached1?.credits).toBe(2_360); // Math.ceil((20,000 * 0.84) / 7.12)
+ expect(cached1?.segments).toEqual([{ quantity: 20_000, rate: 0.84, credits: 16_800 }]);
+
+ const output1 = result1?.breakdown.find((item) => item.unit.name === 'textOutput');
+ expect(output1?.quantity).toBe(10_000);
+ expect(output1?.credits).toBe(23_596); // Math.ceil((10,000 * 16.8) / 7.12)
+ expect(output1?.segments).toEqual([{ quantity: 10_000, rate: 16.8, credits: 168_000 }]);
+
+ // Higher tier test (> 512,000 tokens)
+ const usage2: ModelTokensUsage = {
+ inputCacheMissTokens: 500_000,
+ inputCachedTokens: 100_000,
+ inputTextTokens: 600_000,
+ outputTextTokens: 50_000,
+ totalInputTokens: 600_000,
+ totalOutputTokens: 50_000,
+ totalTokens: 650_000,
+ };
+
+ const result2 = computeChatCost(pricing, usage2);
+ expect(result2).toBeDefined();
+ expect(result2?.issues).toHaveLength(0);
+
+ const input2 = result2?.breakdown.find((item) => item.unit.name === 'textInput');
+ expect(input2?.quantity).toBe(500_000);
+ expect(input2?.credits).toBe(589_888); // Math.ceil((500,000 * 8.4) / 7.12)
+ expect(input2?.segments).toEqual([{ quantity: 500_000, rate: 8.4, credits: 4_200_000 }]);
+
+ const cached2 = result2?.breakdown.find((item) => item.unit.name === 'textInput_cacheRead');
+ expect(cached2?.quantity).toBe(100_000);
+ expect(cached2?.credits).toBe(23_596); // Math.ceil((100,000 * 1.68) / 7.12)
+ expect(cached2?.segments).toEqual([{ quantity: 100_000, rate: 1.68, credits: 168_000 }]);
+
+ const output2 = result2?.breakdown.find((item) => item.unit.name === 'textOutput');
+ expect(output2?.quantity).toBe(50_000);
+ expect(output2?.credits).toBe(235_956); // Math.ceil((50,000 * 33.6) / 7.12)
+ expect(output2?.segments).toEqual([{ quantity: 50_000, rate: 33.6, credits: 1_680_000 }]);
+ });
+ });
+
describe('Anthropic', () => {
it('handles lookup pricing with TTL for Claude Opus 4.1', () => {
const pricing = anthropicChatModels.find(
diff --git a/packages/model-runtime/src/providers/minimax/index.test.ts b/packages/model-runtime/src/providers/minimax/index.test.ts
index 94bdb4c34dd..d9fc93dddd6 100644
--- a/packages/model-runtime/src/providers/minimax/index.test.ts
+++ b/packages/model-runtime/src/providers/minimax/index.test.ts
@@ -268,7 +268,62 @@ describe('LobeMinimaxAI - handlePayload', () => {
]);
// Temperature <= 0 is dropped because MiniMax rejects it.
expect(result.temperature).toBeUndefined();
- // Reasoning split is always enabled.
+ // Non-M3 MiniMax models keep the existing friendly reasoning format.
+ expect(result.reasoning_split).toBe(true);
+ });
+
+ it('enables Interleaved Thinking friendly format for MiniMax-M3', () => {
+ const result = handlePayload({
+ messages: [{ content: 'hi', role: 'user' }],
+ model: 'MiniMax-M3',
+ max_tokens: 4096,
+ n: 2,
+ temperature: 0,
+ thinking: { budget_tokens: 1024, type: 'enabled' },
+ top_p: 1.5,
+ } as any);
+
+ expect(result.max_completion_tokens).toBe(4096);
+ expect(result.max_tokens).toBeUndefined();
+ expect(result.reasoning_split).toBe(true);
+ expect(result.preserveThinking).toBeUndefined();
+ expect(result.temperature).toBe(0);
+ expect(result.thinking).toEqual({ type: 'adaptive' });
+ expect(result.top_p).toBe(1);
+ });
+
+ it('maps disabled enableReasoning payload to MiniMax-M3 thinking disabled', () => {
+ const result = handlePayload({
+ messages: [{ content: 'hi', role: 'user' }],
+ model: 'MiniMax-M3',
+ thinking: { budget_tokens: 0, type: 'disabled' },
+ } as any);
+
+ expect(result.thinking).toEqual({ type: 'disabled' });
+ });
+
+ it('passes through MiniMax-M3 multimodal user content', () => {
+ const content = [
+ { text: 'describe this media', type: 'text' },
+ { image_url: { url: 'https://example.com/image.png' }, type: 'image_url' },
+ { type: 'video_url', video_url: { url: 'https://example.com/video.mp4' } },
+ ];
+
+ const result = handlePayload({
+ messages: [{ content, role: 'user' }],
+ model: 'MiniMax-M3',
+ } as any);
+
+ expect(result.messages[0].content).toBe(content);
+ });
+
+ it('keeps reasoning_split enabled for non-M3 MiniMax models', () => {
+ const result = handlePayload({
+ messages: [{ content: 'hi', role: 'user' }],
+ model: 'MiniMax-M2.7',
+ preserveThinking: false,
+ } as any);
+
expect(result.reasoning_split).toBe(true);
});
});
diff --git a/packages/model-runtime/src/providers/minimax/index.ts b/packages/model-runtime/src/providers/minimax/index.ts
index 1dd255c547f..add283be790 100644
--- a/packages/model-runtime/src/providers/minimax/index.ts
+++ b/packages/model-runtime/src/providers/minimax/index.ts
@@ -22,6 +22,8 @@ const DEFAULT_MINIMAX_ANTHROPIC_BASE_URL = 'https://api.minimax.io/anthropic';
const MINIMAX_ANTHROPIC_BASE_URL_PATTERN = /\/anthropic\/?$/;
const MINIMAX_ANTHROPIC_MESSAGES_PATH_PATTERN = /\/v1\/messages\/?$/;
+const isMiniMaxM3Model = (model: string) => model.toLowerCase() === 'minimax-m3';
+
type MiniMaxSDKType = 'anthropic' | 'openai';
const isEmptyContent = (content: unknown) =>
@@ -106,7 +108,9 @@ export const buildMiniMaxAnthropicPayload = async (
};
export const buildMiniMaxOpenAIPayload = (payload: ChatStreamPayload) => {
- const { enabledSearch, max_tokens, messages, temperature, top_p, ...params } = payload;
+ const { enabledSearch, max_tokens, messages, temperature, thinking, top_p, ...params } = payload;
+
+ const isM3 = isMiniMaxM3Model(payload.model);
// Interleaved thinking
const processedMessages = messages.map((message: any) => {
@@ -153,23 +157,39 @@ export const buildMiniMaxOpenAIPayload = (payload: ChatStreamPayload) => {
top_p,
},
{
- normalizeTemperature: true,
- topPRange: { max: 1, min: 0.01 },
+ normalizeTemperature: !isM3,
+ temperatureRange: isM3 ? { max: 2, min: 0 } : undefined,
+ topPRange: isM3 ? { max: 1, min: 0 } : { max: 1, min: 0.01 },
},
);
// Minimax doesn't support temperature <= 0
const finalTemperature =
- resolvedParams.temperature !== undefined && resolvedParams.temperature <= 0
+ !isM3 && resolvedParams.temperature !== undefined && resolvedParams.temperature <= 0
? undefined
: resolvedParams.temperature;
+ const finalThinking = isM3
+ ? thinking?.type === 'disabled'
+ ? { thinking: { type: 'disabled' } }
+ : thinking?.type === 'enabled' || thinking?.type === 'adaptive'
+ ? { thinking: { type: 'adaptive' } }
+ : {}
+ : thinking
+ ? { thinking }
+ : {};
+
+ const outputLimitParam = isM3
+ ? { max_completion_tokens: resolvedParams.max_tokens }
+ : { max_tokens: resolvedParams.max_tokens };
+
return {
...params,
- max_tokens: resolvedParams.max_tokens,
+ ...outputLimitParam,
messages: processedMessages,
reasoning_split: true,
temperature: finalTemperature,
+ ...finalThinking,
top_p: resolvedParams.top_p,
} as any;
};
@@ -178,6 +198,92 @@ export const openAIParams = {
baseURL: DEFAULT_MINIMAX_BASE_URL,
chatCompletion: {
handlePayload: buildMiniMaxOpenAIPayload,
+ handleTransformResponseToStream: (data) => {
+ const choices = data.choices || [];
+ const first = choices[0];
+ const message = first?.message as any;
+ const reasoningText = Array.isArray(message?.reasoning_details)
+ ? message.reasoning_details
+ .filter((detail: any) => detail.text)
+ .map((detail: any) => detail.text)
+ .join('')
+ : undefined;
+
+ return new ReadableStream({
+ start(controller) {
+ if (reasoningText) {
+ controller.enqueue({
+ choices: [
+ {
+ delta: {
+ content: null,
+ reasoning_details: message.reasoning_details,
+ role: 'assistant',
+ } as any,
+ finish_reason: null,
+ index: first?.index ?? 0,
+ logprobs: first?.logprobs ?? null,
+ },
+ ],
+ created: data.created,
+ id: data.id,
+ model: data.model,
+ object: 'chat.completion.chunk',
+ });
+ }
+
+ controller.enqueue({
+ choices: choices.map((choice: any) => ({
+ delta: {
+ content: choice.message.content,
+ role: choice.message.role,
+ tool_calls: choice.message.tool_calls?.map((tool: any, index: number) => ({
+ function: tool.function,
+ id: tool.id,
+ index,
+ type: tool.type,
+ })),
+ },
+ finish_reason: null,
+ index: choice.index,
+ logprobs: choice.logprobs,
+ })),
+ created: data.created,
+ id: data.id,
+ model: data.model,
+ object: 'chat.completion.chunk',
+ });
+
+ if (data.usage) {
+ controller.enqueue({
+ choices: [],
+ created: data.created,
+ id: data.id,
+ model: data.model,
+ object: 'chat.completion.chunk',
+ usage: data.usage,
+ });
+ }
+
+ controller.enqueue({
+ choices: choices.map((choice: any) => ({
+ delta: {
+ content: null,
+ role: choice.message.role,
+ },
+ finish_reason: choice.finish_reason,
+ index: choice.index,
+ logprobs: choice.logprobs,
+ })),
+ created: data.created,
+ id: data.id,
+ model: data.model,
+ object: 'chat.completion.chunk',
+ });
+ controller.close();
+ },
+ });
+ },
},
createImage: createMiniMaxImage,
createVideo: createMiniMaxVideo,
diff --git a/packages/model-runtime/src/utils/modelParse.ts b/packages/model-runtime/src/utils/modelParse.ts
index 6e6b4ccb560..8bd0903d59b 100644
--- a/packages/model-runtime/src/utils/modelParse.ts
+++ b/packages/model-runtime/src/utils/modelParse.ts
@@ -74,7 +74,7 @@ export const MODEL_LIST_CONFIGS = {
minimax: {
functionCallKeywords: ['minimax'],
reasoningKeywords: ['-m'],
- visionKeywords: ['-vl', 'Text-01'],
+ visionKeywords: ['-vl', 'Text-01', '-m3'],
},
mistral: {
functionCallKeywords: ['mistral', 'ministral', 'pixtral'],