continue-custom/core/llm/llms/MiniMax.ts
Octopus 4714bae00a
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>
2026-03-24 13:06:19 -07:00

37 lines
1 KiB
TypeScript

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;