Skip to content

Commit 08590cf

Browse files
authored
Merge pull request #3295 from Maosghoul/feat/add_minimax_ai
Feat: Add MiniMax AI Provider
2 parents 667106d + 4adb691 commit 08590cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1079
-40
lines changed

.changeset/eighty-parts-attend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": minor
3+
---
4+
5+
MiniMax provider added. MiniMax provider preserves reasoning blocks and has experimental support for native tool calling.

apps/kilocode-docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/features/api-configuration-profiles.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ API 配置配置文件允许您创建和切换不同的 AI 设置集。每个配
3636

3737
- 选择您的 API 提供商
3838

39-
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-2.png" alt="提供商选择下拉菜单" width="550" />
39+
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-2.png" alt="提供商选择下拉菜单" width="550" />
4040

4141
- 输入 API 密钥
4242

43-
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-3.png" alt="API 密钥输入字段" width="550" />
43+
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-3.png" alt="API 密钥输入字段" width="550" />
4444

4545
- 选择模型
4646

47-
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-8.png" alt="模型选择界面" width="550" />
47+
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-8.png" alt="模型选择界面" width="550" />
4848

4949
- 调整模型参数
5050

51-
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-5.png" alt="模型参数调整控件" width="550" />
51+
<img src="/docs/img/api-configuration-profiles/api-configuration-profiles-5.png" alt="模型参数调整控件" width="550" />
5252

5353
### 切换配置文件
5454

cli/src/config/schema.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@
257257
"qwen-code",
258258
"gemini-cli",
259259
"zai",
260+
"minimax",
260261
"unbound",
261262
"requesty",
262263
"roo",
@@ -1207,6 +1208,27 @@
12071208
}
12081209
}
12091210
},
1211+
{
1212+
"if": {
1213+
"properties": { "provider": { "const": "minimax" } }
1214+
},
1215+
"then": {
1216+
"properties": {
1217+
"minimaxBaseUrl": {
1218+
"type": "string",
1219+
"description": "MiniMax base URL"
1220+
},
1221+
"minimaxApiKey": {
1222+
"type": "string",
1223+
"description": "MiniMax API key"
1224+
},
1225+
"apiModelId": {
1226+
"type": "string",
1227+
"description": "MiniMax model ID"
1228+
}
1229+
}
1230+
}
1231+
},
12101232
{
12111233
"if": {
12121234
"properties": { "provider": { "const": "doubao" } }
@@ -1294,6 +1316,48 @@
12941316
}
12951317
}
12961318
},
1319+
{
1320+
"if": {
1321+
"properties": {
1322+
"provider": { "const": "minimax" },
1323+
"minimaxBaseUrl": { "type": "string", "minLength": 1 }
1324+
},
1325+
"required": ["minimaxBaseUrl"]
1326+
},
1327+
"then": {
1328+
"properties": {
1329+
"minimaxBaseUrl": { "minLength": 1 }
1330+
}
1331+
}
1332+
},
1333+
{
1334+
"if": {
1335+
"properties": {
1336+
"provider": { "const": "minimax" },
1337+
"minimaxApiKey": { "type": "string", "minLength": 1 }
1338+
},
1339+
"required": ["minimaxApiKey"]
1340+
},
1341+
"then": {
1342+
"properties": {
1343+
"minimaxApiKey": { "minLength": 10 }
1344+
}
1345+
}
1346+
},
1347+
{
1348+
"if": {
1349+
"properties": {
1350+
"provider": { "const": "minimax" },
1351+
"apiModelId": { "type": "string", "minLength": 1 }
1352+
},
1353+
"required": ["apiModelId"]
1354+
},
1355+
"then": {
1356+
"properties": {
1357+
"apiModelId": { "minLength": 1 }
1358+
}
1359+
}
1360+
},
12971361
{
12981362
"if": {
12991363
"properties": { "provider": { "const": "chutes" } }

cli/src/constants/providers/__tests__/models.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ describe("Static Provider Models", () => {
4242
"cerebras",
4343
"sambanova",
4444
"zai",
45+
"minimax",
4546
"fireworks",
4647
"featherless",
4748
"roo",

cli/src/constants/providers/labels.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export const PROVIDER_LABELS: Record<ProviderName, string> = {
3636
"qwen-code": "Qwen Code",
3737
"gemini-cli": "Gemini CLI",
3838
zai: "Zai",
39+
minimax: "MiniMax",
3940
unbound: "Unbound",
4041
requesty: "Requesty",
4142
roo: "Roo",

cli/src/constants/providers/models.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import {
4545
claudeCodeDefaultModelId,
4646
geminiCliModels,
4747
geminiCliDefaultModelId,
48+
minimaxModels,
49+
minimaxDefaultModelId,
4850
} from "@roo-code/types"
4951

5052
/**
@@ -117,6 +119,7 @@ export const PROVIDER_TO_ROUTER_NAME: Record<ProviderName, RouterName | null> =
117119
moonshot: null,
118120
deepseek: null,
119121
doubao: null,
122+
minimax: null,
120123
"qwen-code": null,
121124
"human-relay": null,
122125
"fake-ai": null,
@@ -162,6 +165,7 @@ export const PROVIDER_MODEL_FIELD: Record<ProviderName, string | null> = {
162165
moonshot: null,
163166
deepseek: null,
164167
doubao: null,
168+
minimax: null,
165169
"qwen-code": null,
166170
"human-relay": null,
167171
"fake-ai": null,
@@ -239,6 +243,7 @@ export const DEFAULT_MODEL_IDS: Partial<Record<ProviderName, string>> = {
239243
sambanova: sambaNovaDefaultModelId,
240244
featherless: featherlessDefaultModelId,
241245
deepinfra: "deepseek-ai/DeepSeek-R1-0528",
246+
minimax: "MiniMax-M2",
242247
zai: internationalZAiDefaultModelId,
243248
roo: rooDefaultModelId,
244249
"gemini-cli": geminiCliDefaultModelId,
@@ -302,6 +307,11 @@ export function getModelsByProvider(params: {
302307
models: moonshotModels as ModelRecord,
303308
defaultModel: moonshotDefaultModelId,
304309
}
310+
case "minimax":
311+
return {
312+
models: minimaxModels as ModelRecord,
313+
defaultModel: minimaxDefaultModelId,
314+
}
305315
case "deepseek":
306316
return {
307317
models: deepSeekModels as ModelRecord,

cli/src/constants/providers/settings.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,18 @@ export const FIELD_REGISTRY: Record<string, FieldMetadata> = {
410410
placeholder: "Enter API line...",
411411
},
412412

413+
// Minimax fields
414+
minimaxBaseUrl: {
415+
label: "Base URL",
416+
type: "text",
417+
placeholder: "Enter MiniMax base URL...",
418+
},
419+
minimaxApiKey: {
420+
label: "API Key",
421+
type: "password",
422+
placeholder: "Enter MiniMax API key...",
423+
},
424+
413425
// Unbound fields
414426
unboundApiKey: {
415427
label: "API Key",
@@ -767,7 +779,11 @@ export const getProviderSettings = (provider: ProviderName, config: ProviderSett
767779
type: "text",
768780
},
769781
]
770-
782+
case "minimax":
783+
return [
784+
createFieldConfig("minimaxBaseUrl", config, "https://api.minimax.io/anthropic"),
785+
createFieldConfig("minimaxApiKey", config),
786+
]
771787
case "fake-ai":
772788
return [
773789
{
@@ -825,6 +841,7 @@ export const PROVIDER_DEFAULT_MODELS: Record<ProviderName, string> = {
825841
"vercel-ai-gateway": "gpt-4o",
826842
"virtual-quota-fallback": "gpt-4o",
827843
"human-relay": "human",
844+
minimax: "MiniMax-M2",
828845
"fake-ai": "fake-model",
829846
}
830847

cli/src/constants/providers/validation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ export const PROVIDER_REQUIRED_FIELDS: Record<ProviderName, string[]> = {
4444
vertex: [], // Has special validation logic (either/or fields)
4545
"vscode-lm": [], // Has nested object validation
4646
"virtual-quota-fallback": [], // Has array validation
47+
minimax: ["minimaxBaseUrl", "minimaxApiKey", "apiModelId"],
4748
}

cli/src/types/messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export type ProviderName =
103103
| "io-intelligence"
104104
| "roo"
105105
| "vercel-ai-gateway"
106+
| "minimax"
106107

107108
// Provider Settings Entry for profile metadata
108109
export interface ProviderSettingsEntry {
@@ -320,6 +321,10 @@ export interface ProviderSettings {
320321
vercelAiGatewayApiKey?: string
321322
vercelAiGatewayModelId?: string
322323

324+
// MiniMax AI
325+
minimaxBaseUrl?: "https://api.minimax.io/anthropic" | "https://api.minimaxi.com/anthropic"
326+
minimaxApiKey?: string
327+
323328
// Allow additional fields for extensibility
324329
[key: string]: any
325330
}

cli/src/ui/messages/extension/ask/AskUseMcpServerMessage.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import React from "react"
22
import { Box, Text } from "ink"
33
import type { MessageComponentProps } from "../types.js"
4-
import {
5-
getMessageIcon,
6-
parseMcpServerData,
7-
formatContentWithMetadata,
8-
buildMetadataString,
9-
} from "../utils.js"
4+
import { getMessageIcon, parseMcpServerData, formatContentWithMetadata, buildMetadataString } from "../utils.js"
105
import { useTheme } from "../../../../state/hooks/useTheme.js"
116
import { getBoxWidth } from "../../../utils/width.js"
127

@@ -38,7 +33,9 @@ export const AskUseMcpServerMessage: React.FC<MessageComponentProps> = ({ messag
3833
const title = isToolUse ? "Use MCP Tool" : "Access MCP Resource"
3934

4035
// Format arguments if present
41-
const formattedArgs = mcpData.arguments ? formatContentWithMetadata(mcpData.arguments, MAX_LINES, PREVIEW_LINES) : null
36+
const formattedArgs = mcpData.arguments
37+
? formatContentWithMetadata(mcpData.arguments, MAX_LINES, PREVIEW_LINES)
38+
: null
4239

4340
return (
4441
<Box flexDirection="column" marginY={1}>
@@ -81,8 +78,7 @@ export const AskUseMcpServerMessage: React.FC<MessageComponentProps> = ({ messag
8178
borderStyle="single"
8279
borderColor={theme.ui.border.default}
8380
paddingX={1}
84-
flexDirection="column"
85-
>
81+
flexDirection="column">
8682
{formattedArgs.content.split("\n").map((line, index) => (
8783
<Text key={index} color={theme.ui.text.dimmed} dimColor>
8884
{line}

0 commit comments

Comments
 (0)