Skip to content

Commit eafed97

Browse files
authored
Fix/minimax context window and models (#12069)
1 parent c3cae39 commit eafed97

3 files changed

Lines changed: 184 additions & 17 deletions

File tree

packages/types/src/providers/minimax.ts

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { ModelInfo } from "../model.js"
22

33
// Minimax
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
4+
// https://platform.minimax.io/docs/guides/models-intro
5+
// https://platform.minimax.io/docs/guides/pricing-paygo
6+
// https://platform.minimax.io/docs/guides/pricing-tokenplan
77
export type MinimaxModelId = keyof typeof minimaxModels
8-
export const minimaxDefaultModelId: MinimaxModelId = "MiniMax-M2.5"
8+
export const minimaxDefaultModelId: MinimaxModelId = "MiniMax-M2.7"
99

1010
export const minimaxModels = {
1111
"MiniMax-M2.5": {
@@ -21,11 +21,56 @@ export const minimaxModels = {
2121
cacheWritesPrice: 0.375,
2222
cacheReadsPrice: 0.03,
2323
description:
24-
"MiniMax M2.5, the latest MiniMax model with enhanced coding and agentic capabilities, building on the strengths of the M2 series.",
24+
"MiniMax M2.5, the latest MiniMax model with enhanced coding and agentic capabilities, building on the strengths of the M2 series. See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Note: When using TokenPlan, usage is billed per request, not per token.",
25+
},
26+
"MiniMax-M2.5-highspeed": {
27+
maxTokens: 16_384,
28+
contextWindow: 204_800,
29+
supportsImages: false,
30+
supportsPromptCache: true,
31+
includedTools: ["search_and_replace"],
32+
excludedTools: ["apply_diff"],
33+
preserveReasoning: true,
34+
inputPrice: 0.6,
35+
outputPrice: 2.4,
36+
cacheWritesPrice: 0.375,
37+
cacheReadsPrice: 0.03,
38+
description:
39+
"MiniMax M2.5 highspeed: same performance as M2.5 but with faster response (approximately 100 tps vs 60 tps). See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Requires TokenPlan High-Speed subscription for use with TokenPlan keys. Note: When using TokenPlan, usage is billed per request, not per token.",
40+
},
41+
"MiniMax-M2.7": {
42+
maxTokens: 16_384,
43+
contextWindow: 204_800,
44+
supportsImages: false,
45+
supportsPromptCache: true,
46+
includedTools: ["search_and_replace"],
47+
excludedTools: ["apply_diff"],
48+
preserveReasoning: true,
49+
inputPrice: 0.3,
50+
outputPrice: 1.2,
51+
cacheWritesPrice: 0.375,
52+
cacheReadsPrice: 0.06,
53+
description:
54+
"MiniMax M2.7, the latest MiniMax model with recursive self-improvement capabilities. See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Note: When using TokenPlan, usage is billed per request, not per token.",
55+
},
56+
"MiniMax-M2.7-highspeed": {
57+
maxTokens: 16_384,
58+
contextWindow: 204_800,
59+
supportsImages: false,
60+
supportsPromptCache: true,
61+
includedTools: ["search_and_replace"],
62+
excludedTools: ["apply_diff"],
63+
preserveReasoning: true,
64+
inputPrice: 0.6,
65+
outputPrice: 2.4,
66+
cacheWritesPrice: 0.375,
67+
cacheReadsPrice: 0.06,
68+
description:
69+
"MiniMax M2.7 highspeed: same performance as M2.7 but with faster response (approximately 100 tps vs 60 tps). See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Requires TokenPlan High-Speed subscription for use with TokenPlan keys. Note: When using TokenPlan, usage is billed per request, not per token.",
2570
},
2671
"MiniMax-M2": {
2772
maxTokens: 16_384,
28-
contextWindow: 192_000,
73+
contextWindow: 204_800,
2974
supportsImages: false,
3075
supportsPromptCache: true,
3176
includedTools: ["search_and_replace"],
@@ -36,11 +81,11 @@ export const minimaxModels = {
3681
cacheWritesPrice: 0.375,
3782
cacheReadsPrice: 0.03,
3883
description:
39-
"MiniMax M2, a model born for Agents and code, featuring Top-tier Coding Capabilities, Powerful Agentic Performance, and Ultimate Cost-Effectiveness & Speed.",
84+
"MiniMax M2, a model born for Agents and code, featuring Top-tier Coding Capabilities, Powerful Agentic Performance, and Ultimate Cost-Effectiveness & Speed. See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Note: When using TokenPlan, usage is billed per request, not per token.",
4085
},
4186
"MiniMax-M2-Stable": {
4287
maxTokens: 16_384,
43-
contextWindow: 192_000,
88+
contextWindow: 204_800,
4489
supportsImages: false,
4590
supportsPromptCache: true,
4691
includedTools: ["search_and_replace"],
@@ -51,11 +96,11 @@ export const minimaxModels = {
5196
cacheWritesPrice: 0.375,
5297
cacheReadsPrice: 0.03,
5398
description:
54-
"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.",
99+
"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. See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Note: When using TokenPlan, usage is billed per request, not per token.",
55100
},
56101
"MiniMax-M2.1": {
57102
maxTokens: 16_384,
58-
contextWindow: 192_000,
103+
contextWindow: 204_800,
59104
supportsImages: false,
60105
supportsPromptCache: true,
61106
includedTools: ["search_and_replace"],
@@ -66,7 +111,22 @@ export const minimaxModels = {
66111
cacheWritesPrice: 0.375,
67112
cacheReadsPrice: 0.03,
68113
description:
69-
"MiniMax M2.1 builds on M2 with improved overall performance for agentic coding tasks and significantly faster response times.",
114+
"MiniMax M2.1 builds on M2 with improved overall performance for agentic coding tasks and significantly faster response times. See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Note: When using TokenPlan, usage is billed per request, not per token.",
115+
},
116+
"MiniMax-M2.1-highspeed": {
117+
maxTokens: 16_384,
118+
contextWindow: 204_800,
119+
supportsImages: false,
120+
supportsPromptCache: true,
121+
includedTools: ["search_and_replace"],
122+
excludedTools: ["apply_diff"],
123+
preserveReasoning: true,
124+
inputPrice: 0.6,
125+
outputPrice: 2.4,
126+
cacheWritesPrice: 0.375,
127+
cacheReadsPrice: 0.03,
128+
description:
129+
"MiniMax M2.1 highspeed: same performance as M2.1 but with faster response (approximately 100 tps vs 60 tps). See pricing at https://platform.minimax.io/docs/guides/pricing-paygo. Requires TokenPlan High-Speed subscription for use with TokenPlan keys. Note: When using TokenPlan, usage is billed per request, not per token.",
70130
},
71131
} as const satisfies Record<string, ModelInfo>
72132

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

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe("MiniMaxHandler", () => {
112112
const model = handlerWithModel.getModel()
113113
expect(model.id).toBe(testModelId)
114114
expect(model.info).toEqual(minimaxModels[testModelId])
115-
expect(model.info.contextWindow).toBe(192_000)
115+
expect(model.info.contextWindow).toBe(204_800)
116116
expect(model.info.maxTokens).toBe(16_384)
117117
expect(model.info.supportsPromptCache).toBe(true)
118118
expect(model.info.cacheWritesPrice).toBe(0.375)
@@ -128,7 +128,7 @@ describe("MiniMaxHandler", () => {
128128
const model = handlerWithModel.getModel()
129129
expect(model.id).toBe(testModelId)
130130
expect(model.info).toEqual(minimaxModels[testModelId])
131-
expect(model.info.contextWindow).toBe(192_000)
131+
expect(model.info.contextWindow).toBe(204_800)
132132
expect(model.info.maxTokens).toBe(16_384)
133133
expect(model.info.supportsPromptCache).toBe(true)
134134
expect(model.info.cacheWritesPrice).toBe(0.375)
@@ -191,10 +191,10 @@ describe("MiniMaxHandler", () => {
191191
expect(model.info).toEqual(minimaxModels[minimaxDefaultModelId])
192192
})
193193

194-
it("should default to MiniMax-M2.5 model", () => {
194+
it("should default to MiniMax-M2.7 model", () => {
195195
const handlerDefault = new MiniMaxHandler({ minimaxApiKey: "test-minimax-api-key" })
196196
const model = handlerDefault.getModel()
197-
expect(model.id).toBe("MiniMax-M2.5")
197+
expect(model.id).toBe("MiniMax-M2.7")
198198
})
199199
})
200200

@@ -399,7 +399,7 @@ describe("MiniMaxHandler", () => {
399399
it("should correctly configure MiniMax-M2 model properties", () => {
400400
const model = minimaxModels["MiniMax-M2"]
401401
expect(model.maxTokens).toBe(16_384)
402-
expect(model.contextWindow).toBe(192_000)
402+
expect(model.contextWindow).toBe(204_800)
403403
expect(model.supportsImages).toBe(false)
404404
expect(model.supportsPromptCache).toBe(true)
405405
expect(model.inputPrice).toBe(0.3)
@@ -411,13 +411,71 @@ describe("MiniMaxHandler", () => {
411411
it("should correctly configure MiniMax-M2-Stable model properties", () => {
412412
const model = minimaxModels["MiniMax-M2-Stable"]
413413
expect(model.maxTokens).toBe(16_384)
414-
expect(model.contextWindow).toBe(192_000)
414+
expect(model.contextWindow).toBe(204_800)
415415
expect(model.supportsImages).toBe(false)
416416
expect(model.supportsPromptCache).toBe(true)
417417
expect(model.inputPrice).toBe(0.3)
418418
expect(model.outputPrice).toBe(1.2)
419419
expect(model.cacheWritesPrice).toBe(0.375)
420420
expect(model.cacheReadsPrice).toBe(0.03)
421421
})
422+
423+
it("should correctly configure MiniMax-M2.7 model properties", () => {
424+
const model = minimaxModels["MiniMax-M2.7"]
425+
expect(model.maxTokens).toBe(16_384)
426+
expect(model.contextWindow).toBe(204_800)
427+
expect(model.supportsImages).toBe(false)
428+
expect(model.supportsPromptCache).toBe(true)
429+
expect(model.inputPrice).toBe(0.3)
430+
expect(model.outputPrice).toBe(1.2)
431+
expect(model.cacheWritesPrice).toBe(0.375)
432+
expect(model.cacheReadsPrice).toBe(0.06)
433+
})
434+
435+
it("should correctly configure MiniMax-M2.7-highspeed model properties", () => {
436+
const model = minimaxModels["MiniMax-M2.7-highspeed"]
437+
expect(model.maxTokens).toBe(16_384)
438+
expect(model.contextWindow).toBe(204_800)
439+
expect(model.supportsImages).toBe(false)
440+
expect(model.supportsPromptCache).toBe(true)
441+
expect(model.inputPrice).toBe(0.6)
442+
expect(model.outputPrice).toBe(2.4)
443+
expect(model.cacheWritesPrice).toBe(0.375)
444+
expect(model.cacheReadsPrice).toBe(0.06)
445+
})
446+
447+
it("should correctly configure MiniMax-M2.5-highspeed model properties", () => {
448+
const model = minimaxModels["MiniMax-M2.5-highspeed"]
449+
expect(model.maxTokens).toBe(16_384)
450+
expect(model.contextWindow).toBe(204_800)
451+
expect(model.supportsImages).toBe(false)
452+
expect(model.supportsPromptCache).toBe(true)
453+
expect(model.inputPrice).toBe(0.6)
454+
expect(model.outputPrice).toBe(2.4)
455+
expect(model.cacheWritesPrice).toBe(0.375)
456+
expect(model.cacheReadsPrice).toBe(0.03)
457+
})
458+
459+
it("should correctly configure MiniMax-M2.1-highspeed model properties", () => {
460+
const model = minimaxModels["MiniMax-M2.1-highspeed"]
461+
expect(model.maxTokens).toBe(16_384)
462+
expect(model.contextWindow).toBe(204_800)
463+
expect(model.supportsImages).toBe(false)
464+
expect(model.supportsPromptCache).toBe(true)
465+
expect(model.inputPrice).toBe(0.6)
466+
expect(model.outputPrice).toBe(2.4)
467+
expect(model.cacheWritesPrice).toBe(0.375)
468+
expect(model.cacheReadsPrice).toBe(0.03)
469+
})
470+
471+
it("should correctly configure MiniMax-M2.1 model properties with updated context window", () => {
472+
const model = minimaxModels["MiniMax-M2.1"]
473+
expect(model.contextWindow).toBe(204_800)
474+
})
475+
476+
it("should correctly configure MiniMax-M2 model properties with updated context window", () => {
477+
const model = minimaxModels["MiniMax-M2"]
478+
expect(model.contextWindow).toBe(204_800)
479+
})
422480
})
423481
})

webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
BEDROCK_1M_CONTEXT_MODEL_IDS,
1212
litellmDefaultModelInfo,
1313
openAiModelInfoSaneDefaults,
14+
minimaxDefaultModelId,
15+
minimaxModels,
1416
} from "@roo-code/types"
1517

1618
import { useSelectedModel } from "../useSelectedModel"
@@ -725,4 +727,51 @@ describe("useSelectedModel", () => {
725727
expect(result.current.info).toEqual(customModelInfo)
726728
})
727729
})
730+
731+
describe("minimax provider", () => {
732+
beforeEach(() => {
733+
mockUseRouterModels.mockReturnValue({
734+
data: {
735+
openrouter: {},
736+
requesty: {},
737+
litellm: {},
738+
},
739+
isLoading: false,
740+
isError: false,
741+
} as any)
742+
743+
mockUseOpenRouterModelProviders.mockReturnValue({
744+
data: {},
745+
isLoading: false,
746+
isError: false,
747+
} as any)
748+
})
749+
750+
it("should return default minimax model when no custom model is specified", () => {
751+
const apiConfiguration: ProviderSettings = {
752+
apiProvider: "minimax",
753+
}
754+
755+
const wrapper = createWrapper()
756+
const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper })
757+
758+
expect(result.current.provider).toBe("minimax")
759+
expect(result.current.id).toBe(minimaxDefaultModelId)
760+
expect(result.current.info).toEqual(minimaxModels[minimaxDefaultModelId])
761+
})
762+
763+
it("should use custom model ID and info when model exists in minimaxModels", () => {
764+
const apiConfiguration: ProviderSettings = {
765+
apiProvider: "minimax",
766+
apiModelId: "MiniMax-M2.7",
767+
}
768+
769+
const wrapper = createWrapper()
770+
const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper })
771+
772+
expect(result.current.provider).toBe("minimax")
773+
expect(result.current.id).toBe("MiniMax-M2.7")
774+
expect(result.current.info).toEqual(minimaxModels["MiniMax-M2.7"])
775+
})
776+
})
728777
})

0 commit comments

Comments
 (0)