Skip to content
Merged
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
21 changes: 21 additions & 0 deletions packages/types/src/providers/minimax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const minimaxModels = {
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
includedTools: ["search_and_replace"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new includedTools: ["search_and_replace"] / excludedTools: ["apply_diff"] settings look inverted compared to other models (most of the codebase uses search_replace as the single-line tool and reserves search_and_replace for the multi-operation tool). If the intent is to prefer the standard toolset, this likely wants search_replace instead.

Fix it with Roo Code or mention @roomote and request a fix.

excludedTools: ["apply_diff"],
preserveReasoning: true,
inputPrice: 0.3,
outputPrice: 1.2,
Expand All @@ -30,6 +32,8 @@ export const minimaxModels = {
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
includedTools: ["search_and_replace"],
excludedTools: ["apply_diff"],
preserveReasoning: true,
inputPrice: 0.3,
outputPrice: 1.2,
Expand All @@ -38,6 +42,23 @@ export const minimaxModels = {
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.1": {
maxTokens: 16_384,
contextWindow: 192_000,
supportsImages: false,
supportsPromptCache: true,
supportsNativeTools: true,
defaultToolProtocol: "native",
includedTools: ["search_and_replace"],
excludedTools: ["apply_diff"],
preserveReasoning: true,
inputPrice: 0.3,
outputPrice: 1.2,
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.",
},
} as const satisfies Record<string, ModelInfo>

export const minimaxDefaultModelInfo: ModelInfo = minimaxModels[minimaxDefaultModelId]
Expand Down
20 changes: 16 additions & 4 deletions src/api/providers/minimax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { ApiHandlerOptions } from "../../shared/api"

import { ApiStream } from "../transform/stream"
import { getModelParams } from "../transform/model-params"
import { mergeEnvironmentDetailsForMiniMax } from "../transform/minimax-format"

import { BaseProvider } from "./base-provider"
import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
Expand Down Expand Up @@ -87,15 +88,26 @@ export class MiniMaxHandler extends BaseProvider implements SingleCompletionHand
// MiniMax M2 models support prompt caching
const supportsPromptCache = info.supportsPromptCache ?? false

// Merge environment_details from messages that follow tool_result blocks
// into the tool_result content. This preserves reasoning continuity for
// thinking models by preventing user messages from interrupting the
// reasoning context after tool use (similar to r1-format's mergeToolResultText).
const processedMessages = mergeEnvironmentDetailsForMiniMax(messages)

// Build the system blocks array
const systemBlocks: Anthropic.Messages.TextBlockParam[] = [
supportsPromptCache
? { text: systemPrompt, type: "text", cache_control: cacheControl }
: { text: systemPrompt, type: "text" },
]

// Prepare request parameters
const requestParams: Anthropic.Messages.MessageCreateParams = {
model: modelId,
max_tokens: maxTokens ?? 16_384,
temperature: temperature ?? 1.0,
system: supportsPromptCache
? [{ text: systemPrompt, type: "text", cache_control: cacheControl }]
: [{ text: systemPrompt, type: "text" }],
messages: supportsPromptCache ? this.addCacheControl(messages, cacheControl) : messages,
system: systemBlocks,
messages: supportsPromptCache ? this.addCacheControl(processedMessages, cacheControl) : processedMessages,
stream: true,
}

Expand Down
Loading
Loading