feat: add MiniMax as a new LLM provider with M2.7 default (#11367)
* feat: add MiniMax as a new LLM provider Add MiniMax (https://platform.minimax.io) as a new LLM provider with OpenAI-compatible API support. Changes: - Add MiniMax LLM provider class extending OpenAI with temperature clamping (must be in (0, 1]) and response_format removal - Register provider in LLMClasses, openai-adapters, and config-types - Add model info for MiniMax-M2.5 and MiniMax-M2.5-highspeed (204K context, 192K max output) - Add GUI model selection entries and provider configuration - Add provider documentation page * fix: use dedicated MiniMaxApi adapter instead of generic OpenAIApi The minimax provider was wired to the generic OpenAIApi via openAICompatible(), which skips MiniMax-specific request fixes. This creates a dedicated MiniMaxApi adapter class that overrides modifyChatBody to apply temperature clamping (MiniMax requires temperature in (0.0, 1.0]) and response_format removal, matching the adaptations already present in core/llm/llms/MiniMax.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: upgrade MiniMax default model to M2.7 - Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to model list - Set MiniMax-M2.7 as default model - Keep all previous models (M2.5, M2.5-highspeed) as alternatives - Update docs and GUI model selection * fix: add minimax to PROVIDER_HANDLES_TEMPLATING and PARALLEL_PROVIDERS MiniMax uses an OpenAI-compatible chat completions API, so it handles templating natively. MiniMax also supports parallel tool calls. Not added to PROVIDER_SUPPORTS_IMAGES since MiniMax M2.7 is text-only. * style: fix prettier formatting in MiniMax provider files --------- Co-authored-by: PR Bot <pr-bot@minimaxi.com> Co-authored-by: octo-patch <octo-patch@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Dallin Romney <dallinromney@gmail.com>
This commit is contained in:
parent
92c4d19813
commit
4714bae00a
13 changed files with 271 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ const PROVIDER_HANDLES_TEMPLATING: string[] = [
|
|||
"openrouter",
|
||||
"deepseek",
|
||||
"xAI",
|
||||
"minimax",
|
||||
"groq",
|
||||
"gemini",
|
||||
"docker",
|
||||
|
|
@ -250,6 +251,7 @@ const PARALLEL_PROVIDERS: string[] = [
|
|||
"vertexai",
|
||||
"function-network",
|
||||
"scaleway",
|
||||
"minimax",
|
||||
"tensorix",
|
||||
];
|
||||
|
||||
|
|
|
|||
37
core/llm/llms/MiniMax.ts
Normal file
37
core/llm/llms/MiniMax.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { ChatMessage, CompletionOptions, LLMOptions } from "../../index.js";
|
||||
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class MiniMax extends OpenAI {
|
||||
static providerName = "minimax";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.minimax.io/v1/",
|
||||
model: "MiniMax-M2.7",
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
};
|
||||
|
||||
protected _convertArgs(options: CompletionOptions, messages: ChatMessage[]) {
|
||||
const finalOptions = super._convertArgs(options, messages);
|
||||
|
||||
// MiniMax requires temperature in (0.0, 1.0] — zero is rejected
|
||||
if (
|
||||
finalOptions.temperature !== undefined &&
|
||||
finalOptions.temperature !== null
|
||||
) {
|
||||
if (finalOptions.temperature <= 0) {
|
||||
finalOptions.temperature = 0.01;
|
||||
} else if (finalOptions.temperature > 1) {
|
||||
finalOptions.temperature = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// MiniMax does not support response_format
|
||||
if ((finalOptions as any).response_format) {
|
||||
delete (finalOptions as any).response_format;
|
||||
}
|
||||
|
||||
return finalOptions;
|
||||
}
|
||||
}
|
||||
|
||||
export default MiniMax;
|
||||
|
|
@ -38,6 +38,7 @@ import Lemonade from "./Lemonade";
|
|||
import LMStudio from "./LMStudio";
|
||||
import Mistral from "./Mistral";
|
||||
import Mimo from "./Mimo";
|
||||
import MiniMax from "./MiniMax";
|
||||
import MockLLM from "./Mock";
|
||||
import Moonshot from "./Moonshot";
|
||||
import Msty from "./Msty";
|
||||
|
|
@ -93,6 +94,7 @@ export const LLMClasses = [
|
|||
LMStudio,
|
||||
Mistral,
|
||||
Mimo,
|
||||
MiniMax,
|
||||
Bedrock,
|
||||
BedrockImport,
|
||||
SageMaker,
|
||||
|
|
|
|||
55
docs/customize/model-providers/more/minimax.mdx
Normal file
55
docs/customize/model-providers/more/minimax.mdx
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: "How to Configure MiniMax with Continue"
|
||||
sidebarTitle: "MiniMax"
|
||||
---
|
||||
|
||||
<Info>
|
||||
Get your API key from the [MiniMax Platform](https://platform.minimax.io)
|
||||
</Info>
|
||||
|
||||
## Configuration
|
||||
|
||||
<Tabs>
|
||||
<Tab title="YAML">
|
||||
```yaml title="config.yaml"
|
||||
name: My Config
|
||||
version: 0.0.1
|
||||
schema: v1
|
||||
|
||||
models:
|
||||
- name: MiniMax M2.7
|
||||
provider: minimax
|
||||
model: MiniMax-M2.7
|
||||
apiKey: <YOUR_MINIMAX_API_KEY>
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="JSON (Deprecated)">
|
||||
```json title="config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "MiniMax M2.7",
|
||||
"provider": "minimax",
|
||||
"model": "MiniMax-M2.7",
|
||||
"apiKey": "<YOUR_MINIMAX_API_KEY>"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Available Models
|
||||
|
||||
| Model | Description |
|
||||
| :---- | :---------- |
|
||||
| `MiniMax-M2.7` | Latest flagship model with enhanced reasoning and coding. 204K context window. |
|
||||
| `MiniMax-M2.7-highspeed` | High-speed version of M2.7 for low-latency scenarios. 204K context window. |
|
||||
| `MiniMax-M2.5` | Peak performance with ultimate value. 204K context window. |
|
||||
| `MiniMax-M2.5-highspeed` | Same performance, faster and more agile. 204K context window. |
|
||||
|
||||
## Notes
|
||||
|
||||
- MiniMax uses an OpenAI-compatible API at `https://api.minimax.io/v1`
|
||||
- Set the `MINIMAX_API_KEY` environment variable or configure `apiKey` in your config
|
||||
- For users in China, set `apiBase` to `https://api.minimaxi.com/v1/`
|
||||
|
|
@ -38,6 +38,7 @@ Beyond the top-level providers, Continue supports many other options:
|
|||
| [Cohere](/customize/model-providers/more/cohere) | Models specialized for semantic search and text generation |
|
||||
| [NVIDIA](/customize/model-providers/more/nvidia) | GPU-accelerated model hosting |
|
||||
| [Cloudflare](/customize/model-providers/more/cloudflare) | Edge-based AI inference services |
|
||||
| [MiniMax](/customize/model-providers/more/minimax) | High-performance models with 200K+ context window |
|
||||
|
||||
### Local Model Options
|
||||
|
||||
|
|
|
|||
|
|
@ -2688,6 +2688,54 @@ export const models: { [key: string]: ModelPackage } = {
|
|||
providerOptions: ["sambanova"],
|
||||
isOpenSource: true,
|
||||
},
|
||||
minimaxM27: {
|
||||
title: "MiniMax M2.7",
|
||||
description:
|
||||
"Latest flagship model with enhanced reasoning and coding capabilities. 204K context window.",
|
||||
params: {
|
||||
title: "MiniMax M2.7",
|
||||
model: "MiniMax-M2.7",
|
||||
contextLength: 204_800,
|
||||
},
|
||||
providerOptions: ["minimax"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
minimaxM27Highspeed: {
|
||||
title: "MiniMax M2.7 Highspeed",
|
||||
description:
|
||||
"High-speed version of M2.7 for low-latency scenarios. 204K context window.",
|
||||
params: {
|
||||
title: "MiniMax M2.7 Highspeed",
|
||||
model: "MiniMax-M2.7-highspeed",
|
||||
contextLength: 204_800,
|
||||
},
|
||||
providerOptions: ["minimax"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
minimaxM25: {
|
||||
title: "MiniMax M2.5",
|
||||
description:
|
||||
"Peak performance with ultimate value. Excels at complex reasoning, code generation, and multi-step tasks with a 204K context window.",
|
||||
params: {
|
||||
title: "MiniMax M2.5",
|
||||
model: "MiniMax-M2.5",
|
||||
contextLength: 204_800,
|
||||
},
|
||||
providerOptions: ["minimax"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
minimaxM25Highspeed: {
|
||||
title: "MiniMax M2.5 Highspeed",
|
||||
description:
|
||||
"Same performance as M2.5, faster and more agile for latency-sensitive tasks with a 204K context window.",
|
||||
params: {
|
||||
title: "MiniMax M2.5 Highspeed",
|
||||
model: "MiniMax-M2.5-highspeed",
|
||||
contextLength: 204_800,
|
||||
},
|
||||
providerOptions: ["minimax"],
|
||||
isOpenSource: false,
|
||||
},
|
||||
AUTODETECT: {
|
||||
title: "Autodetect",
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -579,6 +579,38 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n
|
|||
],
|
||||
apiKeyUrl: "https://console.groq.com/keys",
|
||||
},
|
||||
minimax: {
|
||||
title: "MiniMax",
|
||||
provider: "minimax",
|
||||
description:
|
||||
"MiniMax offers high-performance models with 200K+ context windows at competitive pricing.",
|
||||
longDescription:
|
||||
"To get started with MiniMax, obtain an API key from the [MiniMax Platform](https://platform.minimax.io).",
|
||||
tags: [ModelProviderTags.RequiresApiKey],
|
||||
collectInputFor: [
|
||||
{
|
||||
inputType: "text",
|
||||
key: "apiKey",
|
||||
label: "API Key",
|
||||
placeholder: "Enter your MiniMax API key",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
packages: [
|
||||
models.minimaxM27,
|
||||
models.minimaxM27Highspeed,
|
||||
models.minimaxM25,
|
||||
models.minimaxM25Highspeed,
|
||||
{
|
||||
...models.AUTODETECT,
|
||||
params: {
|
||||
...models.AUTODETECT.params,
|
||||
title: "MiniMax",
|
||||
},
|
||||
},
|
||||
],
|
||||
apiKeyUrl: "https://platform.minimax.io",
|
||||
},
|
||||
deepseek: {
|
||||
title: "DeepSeek",
|
||||
provider: "deepseek",
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export const modelDescriptionSchema = z.object({
|
|||
"nebius",
|
||||
"scaleway",
|
||||
"watsonx",
|
||||
"minimax",
|
||||
]),
|
||||
model: z.string(),
|
||||
apiKey: z.string().optional(),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { Bedrock } from "./providers/bedrock.js";
|
|||
import { Cohere } from "./providers/cohere.js";
|
||||
import { CometAPI } from "./providers/cometapi.js";
|
||||
import { Gemini } from "./providers/gemini.js";
|
||||
import { MiniMax } from "./providers/minimax.js";
|
||||
import { Mistral } from "./providers/mistral.js";
|
||||
import { Ollama } from "./providers/ollama.js";
|
||||
import { OpenAi } from "./providers/openai.js";
|
||||
|
|
@ -25,6 +26,7 @@ export const allModelProviders: ModelProvider[] = [
|
|||
Bedrock,
|
||||
Cohere,
|
||||
CometAPI,
|
||||
MiniMax,
|
||||
xAI,
|
||||
zAI,
|
||||
];
|
||||
|
|
|
|||
47
packages/llm-info/src/providers/minimax.ts
Normal file
47
packages/llm-info/src/providers/minimax.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { ModelProvider } from "../types.js";
|
||||
|
||||
export const MiniMax: ModelProvider = {
|
||||
models: [
|
||||
{
|
||||
model: "MiniMax-M2.7",
|
||||
displayName: "MiniMax M2.7",
|
||||
contextLength: 204800,
|
||||
maxCompletionTokens: 192000,
|
||||
description:
|
||||
"Latest flagship model with enhanced reasoning and coding capabilities.",
|
||||
regex: /MiniMax-M2\.7$/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "MiniMax-M2.7-highspeed",
|
||||
displayName: "MiniMax M2.7 Highspeed",
|
||||
contextLength: 204800,
|
||||
maxCompletionTokens: 192000,
|
||||
description: "High-speed version of M2.7 for low-latency scenarios.",
|
||||
regex: /MiniMax-M2\.7-highspeed/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "MiniMax-M2.5",
|
||||
displayName: "MiniMax M2.5",
|
||||
contextLength: 204800,
|
||||
maxCompletionTokens: 192000,
|
||||
description:
|
||||
"Peak performance with ultimate value. Excels at complex reasoning, code generation, and multi-step tasks.",
|
||||
regex: /MiniMax-M2\.5$/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
{
|
||||
model: "MiniMax-M2.5-highspeed",
|
||||
displayName: "MiniMax M2.5 Highspeed",
|
||||
contextLength: 204800,
|
||||
maxCompletionTokens: 192000,
|
||||
description:
|
||||
"Same performance as M2.5, faster and more agile for latency-sensitive tasks.",
|
||||
regex: /MiniMax-M2\.5-highspeed/i,
|
||||
recommendedFor: ["chat"],
|
||||
},
|
||||
],
|
||||
id: "minimax",
|
||||
displayName: "MiniMax",
|
||||
};
|
||||
35
packages/openai-adapters/src/apis/MiniMax.ts
Normal file
35
packages/openai-adapters/src/apis/MiniMax.ts
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import { ChatCompletionCreateParams } from "openai/resources/index";
|
||||
import { MiniMaxConfig } from "../types.js";
|
||||
import { OpenAIApi } from "./OpenAI.js";
|
||||
|
||||
export const MINIMAX_API_BASE = "https://api.minimax.io/v1/";
|
||||
|
||||
export class MiniMaxApi extends OpenAIApi {
|
||||
constructor(config: MiniMaxConfig) {
|
||||
super({
|
||||
...config,
|
||||
provider: "openai",
|
||||
apiBase: config.apiBase ?? MINIMAX_API_BASE,
|
||||
});
|
||||
}
|
||||
|
||||
modifyChatBody<T extends ChatCompletionCreateParams>(body: T): T {
|
||||
body = super.modifyChatBody(body);
|
||||
|
||||
// MiniMax requires temperature in (0.0, 1.0] — zero is rejected
|
||||
if (body.temperature !== undefined && body.temperature !== null) {
|
||||
if (body.temperature <= 0) {
|
||||
body.temperature = 0.01;
|
||||
} else if (body.temperature > 1) {
|
||||
body.temperature = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// MiniMax does not support response_format
|
||||
if ((body as any).response_format) {
|
||||
delete (body as any).response_format;
|
||||
}
|
||||
|
||||
return body;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ import { GeminiApi } from "./apis/Gemini.js";
|
|||
import { InceptionApi } from "./apis/Inception.js";
|
||||
import { JinaApi } from "./apis/Jina.js";
|
||||
import { LlamastackApi } from "./apis/LlamaStack.js";
|
||||
import { MiniMaxApi } from "./apis/MiniMax.js";
|
||||
import { MockApi } from "./apis/Mock.js";
|
||||
import { MoonshotApi } from "./apis/Moonshot.js";
|
||||
import { OpenAIApi } from "./apis/OpenAI.js";
|
||||
|
|
@ -141,6 +142,8 @@ export function constructLlmApi(config: LLMConfig): BaseLlmApi | undefined {
|
|||
return openAICompatible("http://localhost:8000/v1/", config);
|
||||
case "groq":
|
||||
return openAICompatible("https://api.groq.com/openai/v1/", config);
|
||||
case "minimax":
|
||||
return new MiniMaxApi(config);
|
||||
case "sambanova":
|
||||
return openAICompatible("https://api.sambanova.ai/v1/", config);
|
||||
case "text-gen-webui":
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ export const DeepseekConfigSchema = OpenAIConfigSchema.extend({
|
|||
});
|
||||
export type DeepseekConfig = z.infer<typeof DeepseekConfigSchema>;
|
||||
|
||||
export const MiniMaxConfigSchema = OpenAIConfigSchema.extend({
|
||||
provider: z.literal("minimax"),
|
||||
});
|
||||
export type MiniMaxConfig = z.infer<typeof MiniMaxConfigSchema>;
|
||||
|
||||
export const BedrockConfigSchema = OpenAIConfigSchema.extend({
|
||||
provider: z.literal("bedrock"),
|
||||
// cacheBehavior: z.object({
|
||||
|
|
@ -264,6 +269,7 @@ export const LLMConfigSchema = z.discriminatedUnion("provider", [
|
|||
BedrockConfigSchema,
|
||||
MoonshotConfigSchema,
|
||||
DeepseekConfigSchema,
|
||||
MiniMaxConfigSchema,
|
||||
CohereConfigSchema,
|
||||
AzureConfigSchema,
|
||||
GeminiConfigSchema,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue