Skip to content

Commit bf04849

Browse files
roomote[bot]roomotedaniel-lxs
authored
feat: add MiniMax-M2-Stable model and enable prompt caching (#9072)
Co-authored-by: Roo Code <[email protected]> Co-authored-by: Daniel <[email protected]>
1 parent 7bb7b75 commit bf04849

File tree

2 files changed

+53
-7
lines changed

2 files changed

+53
-7
lines changed
Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import type { ModelInfo } from "../model.js"
22

33
// Minimax
4-
// https://www.minimax.io/platform/document/text_api_intro
5-
// https://www.minimax.io/platform/document/pricing
4+
// https://platform.minimax.io/docs/guides/pricing
5+
// https://platform.minimax.io/docs/api-reference/text-openai-api
6+
// https://platform.minimax.io/docs/api-reference/text-anthropic-api
67
export type MinimaxModelId = keyof typeof minimaxModels
78
export const minimaxDefaultModelId: MinimaxModelId = "MiniMax-M2"
89

@@ -11,15 +12,28 @@ export const minimaxModels = {
1112
maxTokens: 16_384,
1213
contextWindow: 192_000,
1314
supportsImages: false,
14-
supportsPromptCache: false,
15+
supportsPromptCache: true,
1516
inputPrice: 0.3,
1617
outputPrice: 1.2,
17-
cacheWritesPrice: 0,
18-
cacheReadsPrice: 0,
18+
cacheWritesPrice: 0.375,
19+
cacheReadsPrice: 0.03,
1920
preserveReasoning: true,
2021
description:
2122
"MiniMax M2, a model born for Agents and code, featuring Top-tier Coding Capabilities, Powerful Agentic Performance, and Ultimate Cost-Effectiveness & Speed.",
2223
},
24+
"MiniMax-M2-Stable": {
25+
maxTokens: 16_384,
26+
contextWindow: 192_000,
27+
supportsImages: false,
28+
supportsPromptCache: true,
29+
inputPrice: 0.3,
30+
outputPrice: 1.2,
31+
cacheWritesPrice: 0.375,
32+
cacheReadsPrice: 0.03,
33+
preserveReasoning: true,
34+
description:
35+
"MiniMax M2 Stable (High Concurrency, Commercial Use), a model born for Agents and code, featuring Top-tier Coding Capabilities, Powerful Agentic Performance, and Ultimate Cost-Effectiveness & Speed.",
36+
},
2337
} as const satisfies Record<string, ModelInfo>
2438

2539
export const MINIMAX_DEFAULT_TEMPERATURE = 1.0

src/api/providers/__tests__/minimax.spec.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,25 @@ describe("MiniMaxHandler", () => {
8282
expect(model.info).toEqual(minimaxModels[testModelId])
8383
expect(model.info.contextWindow).toBe(192_000)
8484
expect(model.info.maxTokens).toBe(16_384)
85-
expect(model.info.supportsPromptCache).toBe(false)
85+
expect(model.info.supportsPromptCache).toBe(true)
86+
expect(model.info.cacheWritesPrice).toBe(0.375)
87+
expect(model.info.cacheReadsPrice).toBe(0.03)
88+
})
89+
90+
it("should return MiniMax-M2-Stable model with correct configuration", () => {
91+
const testModelId: MinimaxModelId = "MiniMax-M2-Stable"
92+
const handlerWithModel = new MiniMaxHandler({
93+
apiModelId: testModelId,
94+
minimaxApiKey: "test-minimax-api-key",
95+
})
96+
const model = handlerWithModel.getModel()
97+
expect(model.id).toBe(testModelId)
98+
expect(model.info).toEqual(minimaxModels[testModelId])
99+
expect(model.info.contextWindow).toBe(192_000)
100+
expect(model.info.maxTokens).toBe(16_384)
101+
expect(model.info.supportsPromptCache).toBe(true)
102+
expect(model.info.cacheWritesPrice).toBe(0.375)
103+
expect(model.info.cacheReadsPrice).toBe(0.03)
86104
})
87105
})
88106

@@ -269,9 +287,23 @@ describe("MiniMaxHandler", () => {
269287
expect(model.maxTokens).toBe(16_384)
270288
expect(model.contextWindow).toBe(192_000)
271289
expect(model.supportsImages).toBe(false)
272-
expect(model.supportsPromptCache).toBe(false)
290+
expect(model.supportsPromptCache).toBe(true)
291+
expect(model.inputPrice).toBe(0.3)
292+
expect(model.outputPrice).toBe(1.2)
293+
expect(model.cacheWritesPrice).toBe(0.375)
294+
expect(model.cacheReadsPrice).toBe(0.03)
295+
})
296+
297+
it("should correctly configure MiniMax-M2-Stable model properties", () => {
298+
const model = minimaxModels["MiniMax-M2-Stable"]
299+
expect(model.maxTokens).toBe(16_384)
300+
expect(model.contextWindow).toBe(192_000)
301+
expect(model.supportsImages).toBe(false)
302+
expect(model.supportsPromptCache).toBe(true)
273303
expect(model.inputPrice).toBe(0.3)
274304
expect(model.outputPrice).toBe(1.2)
305+
expect(model.cacheWritesPrice).toBe(0.375)
306+
expect(model.cacheReadsPrice).toBe(0.03)
275307
})
276308
})
277309
})

0 commit comments

Comments
 (0)