diff --git a/packages/types/src/providers/minimax.ts b/packages/types/src/providers/minimax.ts index a47907168d6..2ac02cf9af5 100644 --- a/packages/types/src/providers/minimax.ts +++ b/packages/types/src/providers/minimax.ts @@ -1,11 +1,11 @@ import type { ModelInfo } from "../model.js" // Minimax -// https://platform.minimax.io/docs/guides/pricing -// https://platform.minimax.io/docs/api-reference/text-openai-api -// https://platform.minimax.io/docs/api-reference/text-anthropic-api +// https://platform.minimax.io/docs/guides/models-intro +// https://platform.minimax.io/docs/guides/pricing-paygo +// https://platform.minimax.io/docs/guides/pricing-tokenplan export type MinimaxModelId = keyof typeof minimaxModels -export const minimaxDefaultModelId: MinimaxModelId = "MiniMax-M2.5" +export const minimaxDefaultModelId: MinimaxModelId = "MiniMax-M2.7" export const minimaxModels = { "MiniMax-M2.5": { @@ -21,11 +21,56 @@ export const minimaxModels = { cacheWritesPrice: 0.375, cacheReadsPrice: 0.03, description: - "MiniMax M2.5, the latest MiniMax model with enhanced coding and agentic capabilities, building on the strengths of the M2 series.", + "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.", + }, + "MiniMax-M2.5-highspeed": { + maxTokens: 16_384, + contextWindow: 204_800, + supportsImages: false, + supportsPromptCache: true, + includedTools: ["search_and_replace"], + excludedTools: ["apply_diff"], + preserveReasoning: true, + inputPrice: 0.6, + outputPrice: 2.4, + cacheWritesPrice: 0.375, + cacheReadsPrice: 0.03, + description: + "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.", + }, + "MiniMax-M2.7": { + maxTokens: 16_384, + contextWindow: 204_800, + supportsImages: false, + supportsPromptCache: true, + includedTools: ["search_and_replace"], + excludedTools: ["apply_diff"], + preserveReasoning: true, + inputPrice: 0.3, + outputPrice: 1.2, + cacheWritesPrice: 0.375, + cacheReadsPrice: 0.06, + description: + "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.", + }, + "MiniMax-M2.7-highspeed": { + maxTokens: 16_384, + contextWindow: 204_800, + supportsImages: false, + supportsPromptCache: true, + includedTools: ["search_and_replace"], + excludedTools: ["apply_diff"], + preserveReasoning: true, + inputPrice: 0.6, + outputPrice: 2.4, + cacheWritesPrice: 0.375, + cacheReadsPrice: 0.06, + description: + "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.", }, "MiniMax-M2": { maxTokens: 16_384, - contextWindow: 192_000, + contextWindow: 204_800, supportsImages: false, supportsPromptCache: true, includedTools: ["search_and_replace"], @@ -36,11 +81,11 @@ export const minimaxModels = { cacheWritesPrice: 0.375, cacheReadsPrice: 0.03, description: - "MiniMax M2, a model born for Agents and code, featuring Top-tier Coding Capabilities, Powerful Agentic Performance, and Ultimate Cost-Effectiveness & Speed.", + "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.", }, "MiniMax-M2-Stable": { maxTokens: 16_384, - contextWindow: 192_000, + contextWindow: 204_800, supportsImages: false, supportsPromptCache: true, includedTools: ["search_and_replace"], @@ -51,11 +96,11 @@ export const minimaxModels = { cacheWritesPrice: 0.375, cacheReadsPrice: 0.03, description: - "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.", + "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.", }, "MiniMax-M2.1": { maxTokens: 16_384, - contextWindow: 192_000, + contextWindow: 204_800, supportsImages: false, supportsPromptCache: true, includedTools: ["search_and_replace"], @@ -66,7 +111,22 @@ export const minimaxModels = { cacheWritesPrice: 0.375, cacheReadsPrice: 0.03, description: - "MiniMax M2.1 builds on M2 with improved overall performance for agentic coding tasks and significantly faster response times.", + "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.", + }, + "MiniMax-M2.1-highspeed": { + maxTokens: 16_384, + contextWindow: 204_800, + supportsImages: false, + supportsPromptCache: true, + includedTools: ["search_and_replace"], + excludedTools: ["apply_diff"], + preserveReasoning: true, + inputPrice: 0.6, + outputPrice: 2.4, + cacheWritesPrice: 0.375, + cacheReadsPrice: 0.03, + description: + "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.", }, } as const satisfies Record diff --git a/src/api/providers/__tests__/minimax.spec.ts b/src/api/providers/__tests__/minimax.spec.ts index e5df368f50d..37f6f127982 100644 --- a/src/api/providers/__tests__/minimax.spec.ts +++ b/src/api/providers/__tests__/minimax.spec.ts @@ -112,7 +112,7 @@ describe("MiniMaxHandler", () => { const model = handlerWithModel.getModel() expect(model.id).toBe(testModelId) expect(model.info).toEqual(minimaxModels[testModelId]) - expect(model.info.contextWindow).toBe(192_000) + expect(model.info.contextWindow).toBe(204_800) expect(model.info.maxTokens).toBe(16_384) expect(model.info.supportsPromptCache).toBe(true) expect(model.info.cacheWritesPrice).toBe(0.375) @@ -128,7 +128,7 @@ describe("MiniMaxHandler", () => { const model = handlerWithModel.getModel() expect(model.id).toBe(testModelId) expect(model.info).toEqual(minimaxModels[testModelId]) - expect(model.info.contextWindow).toBe(192_000) + expect(model.info.contextWindow).toBe(204_800) expect(model.info.maxTokens).toBe(16_384) expect(model.info.supportsPromptCache).toBe(true) expect(model.info.cacheWritesPrice).toBe(0.375) @@ -191,10 +191,10 @@ describe("MiniMaxHandler", () => { expect(model.info).toEqual(minimaxModels[minimaxDefaultModelId]) }) - it("should default to MiniMax-M2.5 model", () => { + it("should default to MiniMax-M2.7 model", () => { const handlerDefault = new MiniMaxHandler({ minimaxApiKey: "test-minimax-api-key" }) const model = handlerDefault.getModel() - expect(model.id).toBe("MiniMax-M2.5") + expect(model.id).toBe("MiniMax-M2.7") }) }) @@ -399,7 +399,7 @@ describe("MiniMaxHandler", () => { it("should correctly configure MiniMax-M2 model properties", () => { const model = minimaxModels["MiniMax-M2"] expect(model.maxTokens).toBe(16_384) - expect(model.contextWindow).toBe(192_000) + expect(model.contextWindow).toBe(204_800) expect(model.supportsImages).toBe(false) expect(model.supportsPromptCache).toBe(true) expect(model.inputPrice).toBe(0.3) @@ -411,7 +411,7 @@ describe("MiniMaxHandler", () => { it("should correctly configure MiniMax-M2-Stable model properties", () => { const model = minimaxModels["MiniMax-M2-Stable"] expect(model.maxTokens).toBe(16_384) - expect(model.contextWindow).toBe(192_000) + expect(model.contextWindow).toBe(204_800) expect(model.supportsImages).toBe(false) expect(model.supportsPromptCache).toBe(true) expect(model.inputPrice).toBe(0.3) @@ -419,5 +419,63 @@ describe("MiniMaxHandler", () => { expect(model.cacheWritesPrice).toBe(0.375) expect(model.cacheReadsPrice).toBe(0.03) }) + + it("should correctly configure MiniMax-M2.7 model properties", () => { + const model = minimaxModels["MiniMax-M2.7"] + expect(model.maxTokens).toBe(16_384) + expect(model.contextWindow).toBe(204_800) + expect(model.supportsImages).toBe(false) + expect(model.supportsPromptCache).toBe(true) + expect(model.inputPrice).toBe(0.3) + expect(model.outputPrice).toBe(1.2) + expect(model.cacheWritesPrice).toBe(0.375) + expect(model.cacheReadsPrice).toBe(0.06) + }) + + it("should correctly configure MiniMax-M2.7-highspeed model properties", () => { + const model = minimaxModels["MiniMax-M2.7-highspeed"] + expect(model.maxTokens).toBe(16_384) + expect(model.contextWindow).toBe(204_800) + expect(model.supportsImages).toBe(false) + expect(model.supportsPromptCache).toBe(true) + expect(model.inputPrice).toBe(0.6) + expect(model.outputPrice).toBe(2.4) + expect(model.cacheWritesPrice).toBe(0.375) + expect(model.cacheReadsPrice).toBe(0.06) + }) + + it("should correctly configure MiniMax-M2.5-highspeed model properties", () => { + const model = minimaxModels["MiniMax-M2.5-highspeed"] + expect(model.maxTokens).toBe(16_384) + expect(model.contextWindow).toBe(204_800) + expect(model.supportsImages).toBe(false) + expect(model.supportsPromptCache).toBe(true) + expect(model.inputPrice).toBe(0.6) + expect(model.outputPrice).toBe(2.4) + expect(model.cacheWritesPrice).toBe(0.375) + expect(model.cacheReadsPrice).toBe(0.03) + }) + + it("should correctly configure MiniMax-M2.1-highspeed model properties", () => { + const model = minimaxModels["MiniMax-M2.1-highspeed"] + expect(model.maxTokens).toBe(16_384) + expect(model.contextWindow).toBe(204_800) + expect(model.supportsImages).toBe(false) + expect(model.supportsPromptCache).toBe(true) + expect(model.inputPrice).toBe(0.6) + expect(model.outputPrice).toBe(2.4) + expect(model.cacheWritesPrice).toBe(0.375) + expect(model.cacheReadsPrice).toBe(0.03) + }) + + it("should correctly configure MiniMax-M2.1 model properties with updated context window", () => { + const model = minimaxModels["MiniMax-M2.1"] + expect(model.contextWindow).toBe(204_800) + }) + + it("should correctly configure MiniMax-M2 model properties with updated context window", () => { + const model = minimaxModels["MiniMax-M2"] + expect(model.contextWindow).toBe(204_800) + }) }) }) diff --git a/webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts b/webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts index 2c24e4b565f..ed408d4e597 100644 --- a/webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts +++ b/webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.ts @@ -11,6 +11,8 @@ import { BEDROCK_1M_CONTEXT_MODEL_IDS, litellmDefaultModelInfo, openAiModelInfoSaneDefaults, + minimaxDefaultModelId, + minimaxModels, } from "@roo-code/types" import { useSelectedModel } from "../useSelectedModel" @@ -725,4 +727,51 @@ describe("useSelectedModel", () => { expect(result.current.info).toEqual(customModelInfo) }) }) + + describe("minimax provider", () => { + beforeEach(() => { + mockUseRouterModels.mockReturnValue({ + data: { + openrouter: {}, + requesty: {}, + litellm: {}, + }, + isLoading: false, + isError: false, + } as any) + + mockUseOpenRouterModelProviders.mockReturnValue({ + data: {}, + isLoading: false, + isError: false, + } as any) + }) + + it("should return default minimax model when no custom model is specified", () => { + const apiConfiguration: ProviderSettings = { + apiProvider: "minimax", + } + + const wrapper = createWrapper() + const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper }) + + expect(result.current.provider).toBe("minimax") + expect(result.current.id).toBe(minimaxDefaultModelId) + expect(result.current.info).toEqual(minimaxModels[minimaxDefaultModelId]) + }) + + it("should use custom model ID and info when model exists in minimaxModels", () => { + const apiConfiguration: ProviderSettings = { + apiProvider: "minimax", + apiModelId: "MiniMax-M2.7", + } + + const wrapper = createWrapper() + const { result } = renderHook(() => useSelectedModel(apiConfiguration), { wrapper }) + + expect(result.current.provider).toBe("minimax") + expect(result.current.id).toBe("MiniMax-M2.7") + expect(result.current.info).toEqual(minimaxModels["MiniMax-M2.7"]) + }) + }) })