Skip to content

Commit 0a7cc90

Browse files
committed
feat: upgrade MiniMax provider to M2.7 models
Add MiniMax-M2.7 and MiniMax-M2.7-highspeed as the recommended models, with thinking-tag stripping for M2.7's chain-of-thought output. Existing M2.5 models remain available for backward compatibility. Co-Authored-By: Octopus <liyuan851277048@icloud.com>
1 parent 68c17df commit 0a7cc90

4 files changed

Lines changed: 24 additions & 5 deletions

File tree

packages/core/lib/v3/llm/LLMProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ const modelToProviderMap: { [key in AvailableModel]: ModelProvider } = {
9898
"gemini-2.0-flash": "google",
9999
"gemini-2.5-flash-preview-04-17": "google",
100100
"gemini-2.5-pro-preview-03-25": "google",
101+
"minimax-MiniMax-M2.7": "minimax",
102+
"minimax-MiniMax-M2.7-highspeed": "minimax",
101103
"minimax-MiniMax-M2.5": "minimax",
102104
"minimax-MiniMax-M2.5-highspeed": "minimax",
103105
};

packages/core/lib/v3/llm/MiniMaxClient.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,19 @@ export class MiniMaxClient extends LLMClient {
4040
this.clientOptions = clientOptions;
4141
}
4242

43+
/**
44+
* Strip thinking tags from M2.7 model responses.
45+
* M2.7 models include `<think>...</think>` blocks in their output.
46+
*/
47+
private stripThinking(content: string | null): string | null {
48+
if (!content) return content;
49+
return content.replace(/<think>[\s\S]*?<\/think>\s*/g, "").trim() || null;
50+
}
51+
4352
/**
4453
* Extract the actual model name to send to the MiniMax API.
45-
* Handles both modern format (minimax/MiniMax-M2.5) and
46-
* deprecated format (minimax-MiniMax-M2.5).
54+
* Handles both modern format (minimax/MiniMax-M2.7) and
55+
* deprecated format (minimax-MiniMax-M2.7).
4756
*/
4857
private getApiModelName(): string {
4958
if (this.modelName.includes("/")) {
@@ -171,6 +180,10 @@ export class MiniMaxClient extends LLMClient {
171180
tool_choice: options.tool_choice || "auto",
172181
});
173182

183+
// Strip thinking tags from M2.7 model responses
184+
const rawContent = apiResponse.choices[0]?.message?.content || null;
185+
const cleanedContent = this.stripThinking(rawContent);
186+
174187
// Format the response to match the expected LLMResponse format
175188
const response: LLMResponse = {
176189
id: apiResponse.id,
@@ -182,7 +195,7 @@ export class MiniMaxClient extends LLMClient {
182195
index: 0,
183196
message: {
184197
role: "assistant",
185-
content: apiResponse.choices[0]?.message?.content || null,
198+
content: cleanedContent,
186199
tool_calls: apiResponse.choices[0]?.message?.tool_calls || [],
187200
},
188201
finish_reason: apiResponse.choices[0]?.finish_reason || "stop",

packages/core/lib/v3/types/public/model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ export type AvailableModel =
8484
| "gemini-2.0-flash"
8585
| "gemini-2.5-flash-preview-04-17"
8686
| "gemini-2.5-pro-preview-03-25"
87+
| "minimax-MiniMax-M2.7"
88+
| "minimax-MiniMax-M2.7-highspeed"
8789
| "minimax-MiniMax-M2.5"
8890
| "minimax-MiniMax-M2.5-highspeed"
8991
| string;

packages/docs/v3/configuration/models.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ import { Stagehand } from "@browserbasehq/stagehand";
226226

227227
const stagehand = new Stagehand({
228228
env: "BROWSERBASE",
229-
model: "minimax/MiniMax-M2.5"
229+
model: "minimax/MiniMax-M2.7"
230230
// API key auto-loads from MINIMAX_API_KEY - set in your .env
231231
});
232232

@@ -235,7 +235,7 @@ await stagehand.init();
235235

236236
</CodeGroup>
237237

238-
Available models: `MiniMax-M2.5` (204K context), `MiniMax-M2.5-highspeed` (204K context, optimized for speed).
238+
Available models: `MiniMax-M2.7` (recommended), `MiniMax-M2.7-highspeed` (optimized for speed), `MiniMax-M2.5` (204K context), `MiniMax-M2.5-highspeed` (204K context, optimized for speed).
239239

240240
[View all supported MiniMax models →](https://platform.minimaxi.com/document/Models)
241241
</Tab>
@@ -854,6 +854,8 @@ The following models work without the `provider/` prefix in the model parameter
854854
</Accordion>
855855
<Accordion title="MiniMax">
856856

857+
- `minimax-MiniMax-M2.7`
858+
- `minimax-MiniMax-M2.7-highspeed`
857859
- `minimax-MiniMax-M2.5`
858860
- `minimax-MiniMax-M2.5-highspeed`
859861

0 commit comments

Comments
 (0)