Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: add MiniMax to Connections (#16011)

Nilayf8c1f2c92f62
diff --git a/studio/backend/core/inference/external_provider.py b/studio/backend/core/inference/external_provider.py
index 4f2a7db67cf..99b0ab825e0 100644
--- a/studio/backend/core/inference/external_provider.py
+++ b/studio/backend/core/inference/external_provider.py
@@ -786,6 +786,26 @@ def _mistral_thinking_spec(model: str) -> _MistralThinkingSpec:
return _MistralThinkingSpec(models = (), style = "disabled")
+_MINIMAX_EFFORTS = ("low", "medium", "high", "xhigh", "max")
+
+
+def _apply_minimax_reasoning_controls(
+ body: dict[str, Any],
+ model: str,
+ enable_thinking: Optional[bool],
+ reasoning_effort: Optional[str],
+) -> None:
+ """M3.1-Flash 400s on thinking off; M3 can disable it."""
+ body["reasoning_split"] = True
+ normalized = model.strip().lower()
+ if normalized.startswith("minimax-m3.1"):
+ effort = (reasoning_effort or "").strip().lower()
+ if effort in _MINIMAX_EFFORTS:
+ body["reasoning_effort"] = effort
+ elif normalized == "minimax-m3" and enable_thinking is False:
+ body["thinking"] = {"type": "disabled"}
+
+
def _apply_mistral_reasoning_controls(
body: dict[str, Any],
model: str,
@@ -1762,8 +1782,8 @@ class ExternalProviderClient:
if stream and self.provider_type in _USAGE_STREAM_OPTION_PROVIDERS:
body["stream_options"] = {"include_usage": True}
if max_tokens is not None:
- # Newer OpenAI models (gpt-4o, gpt-5.x) reject max_tokens
- if self.provider_type == "openai":
+ # Newer OpenAI models reject max_tokens; MiniMax counts thinking against it.
+ if self.provider_type in ("openai", "minimax"):
body["max_completion_tokens"] = max_tokens
else:
body["max_tokens"] = max_tokens
@@ -1800,6 +1820,8 @@ class ExternalProviderClient:
body["thinking"] = {"type": "disabled"}
elif self.provider_type == "mistral":
_apply_mistral_reasoning_controls(body, model, enable_thinking, reasoning_effort)
+ elif self.provider_type == "minimax":
+ _apply_minimax_reasoning_controls(body, model, enable_thinking, reasoning_effort)
elif self.provider_type == "deepseek":
_apply_deepseek_reasoning_controls(body, enable_thinking, reasoning_effort)
elif self.provider_type in ("qwen", "qwencloud"):
diff --git a/studio/backend/core/inference/external_tool_transport.py b/studio/backend/core/inference/external_tool_transport.py
index b999c30b30f..c608befb703 100644
--- a/studio/backend/core/inference/external_tool_transport.py
+++ b/studio/backend/core/inference/external_tool_transport.py
@@ -61,9 +61,11 @@ class OAICompatTransport:
self._initial_message_count: int | None = None
self._last_tools: list[dict[str, Any]] | None = None
# Always, as the local GGUF loop does: preserve_thinking hides earlier turns, never this turn's tool rounds.
- self.preserves_reasoning = client.provider_type in ("llama_cpp", "vllm") or _is_kimi_k3(
- client.provider_type, model
- )
+ self.preserves_reasoning = client.provider_type in (
+ "llama_cpp",
+ "vllm",
+ "minimax",
+ ) or _is_kimi_k3(client.provider_type, model)
def stream(
self,
diff --git a/studio/backend/core/inference/providers.py b/studio/backend/core/inference/providers.py
index 44dd4d37a9c..62220729fe1 100644
--- a/studio/backend/core/inference/providers.py
+++ b/studio/backend/core/inference/providers.py
@@ -286,6 +286,29 @@ PROVIDER_REGISTRY: dict[str, dict[str, Any]] = {
"notes": "Z.ai API key. China mainland: use base URL https://open.bigmodel.cn/api/paas/v4",
"body_omit": ("presence_penalty",),
},
+ "minimax": {
+ "display_name": "MiniMax",
+ "base_url": "https://api.minimax.io/v1",
+ "default_models": [
+ "MiniMax-M3.1-Flash",
+ "MiniMax-M3",
+ ],
+ "model_capabilities": {
+ "MiniMax-M3.1-Flash": {"vision": True},
+ "MiniMax-M3": {"vision": True},
+ },
+ "supports_streaming": True,
+ "supports_vision": True,
+ "supports_tool_calling": True,
+ "studio_tools": True,
+ "auth_header": "Authorization",
+ "auth_prefix": "Bearer ",
+ "notes": "MiniMax API key. China: use base URL https://api.minimaxi.com/v1",
+ # /v1/models lists every model on the account, retired M2.x (404) included; keep M3 and up.
+ "model_id_allowlist": re.compile(r"^MiniMax-M(?:[3-9]|\d\d)", re.IGNORECASE),
+ # Fixed at 1 / 0.95 server-side (https://platform.minimax.io/docs/api-reference/text-openai-api).
+ "body_omit": ("temperature", "top_p", "presence_penalty"),
+ },
# Zen is pay as you go, Go a subscription; both translate every text model to /chat/completions.
"opencode": {
"display_name": "OpenCode Zen",
diff --git a/studio/backend/routes/inference.py b/studio/backend/routes/inference.py
index acf81654ee1..604677769e2 100644
--- a/studio/backend/routes/inference.py
+++ b/studio/backend/routes/inference.py
@@ -27608,6 +27608,8 @@ def _build_external_messages(
# Thinking mode with tools answers 400 without it, and ignores it elsewhere
# (api-docs.deepseek.com/guides/thinking_mode).
or provider_type == "deepseek"
+ # Tool turns need the thinking back (platform.minimax.io/docs/api-reference/text-openai-api).
+ or provider_type == "minimax"
)
result = []
for msg in messages:
diff --git a/studio/backend/tests/test_minimax_provider.py b/studio/backend/tests/test_minimax_provider.py
new file mode 100644
index 00000000000..329f5a049b2
--- /dev/null
+++ b/studio/backend/tests/test_minimax_provider.py
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import asyncio
+import json
+
+import httpx
+import pytest
+
+from core.inference import external_provider as ep
+from core.inference.providers import get_base_url, get_provider_info, list_available_providers
+
+
+def _capture(monkeypatch, model, **kwargs) -> dict:
+ captured: dict = {}
+
+ def handler(request):
+ captured["url"] = str(request.url)
+ captured["body"] = json.loads(request.content)
+ return httpx.Response(
+ 200, headers = {"content-type": "text/event-stream"}, content = "data: [DONE]\n\n"
+ )
+
+ async def run():
+ async with httpx.AsyncClient(transport = httpx.MockTransport(handler)) as http:
+ monkeypatch.setattr(ep, "_client", lambda: http)
+ client = ep.ExternalProviderClient("minimax", get_base_url("minimax"), "sk-test")
+ async for _ in client.stream_chat_completion(
+ messages = [{"role": "user", "content": "hi"}],
+ model = model,
+ temperature = 0.7,
+ top_p = 0.95,
+ max_tokens = 256,
+ **kwargs,
+ ):
+ pass
+
+ asyncio.run(run())
+ return captured
+
+
+def test_minimax_listed():
+ assert "minimax" in {p["provider_type"] for p in list_available_providers()}
+
+
+def test_minimax_lists_chat_models_live():
+ info = get_provider_info("minimax")
+ assert info.get("model_list_mode") != "curated"
+ chat = ["MiniMax-M3.1-Flash", "MiniMax-M3"]
+ retired = ["MiniMax-M2.7", "MiniMax-M2.5-highspeed", "MiniMax-M2"]
+ listed = chat + retired + ["speech-2.8-hd", "MiniMax-Hailuo-2.3", "image-01"]
+ assert [m for m in listed if info["model_id_allowlist"].match(m)] == chat
+ assert info["default_models"] == chat
+
+
+def test_minimax_body_shape(monkeypatch):
+ cap = _capture(monkeypatch, "MiniMax-M3")
+ body = cap["body"]
+ assert cap["url"] == "https://api.minimax.io/v1/chat/completions"
+ assert body["max_completion_tokens"] == 256
+ assert "max_tokens" not in body
+ assert body["reasoning_split"] is True
+ for field in ("temperature", "top_p", "presence_penalty", "thinking"):
+ assert field not in body
+
+
+def test_minimax_m3_thinking_off(monkeypatch):
+ cap = _capture(monkeypatch, "MiniMax-M3", enable_thinking = False)
+ assert cap["body"]["thinking"] == {"type": "disabled"}
+
+
[email protected](("effort", "sent"), [("xhigh", "xhigh"), ("none", None)])
+def test_minimax_m31_flash_effort_and_never_disabled(monkeypatch, effort, sent):
+ cap = _capture(
+ monkeypatch, "MiniMax-M3.1-Flash", enable_thinking = False, reasoning_effort = effort
+ )
+ assert cap["body"].get("reasoning_effort") == sent
+ assert "thinking" not in cap["body"]
+
+
+def test_minimax_history_keeps_reasoning():
+ from models.inference import ChatMessage
+ from routes.inference import _build_external_messages
+
+ calls = [
+ {"id": "call_1", "type": "function", "function": {"name": "lookup", "arguments": "{}"}}
+ ]
+ history = [
+ ChatMessage(role = "user", content = "hi"),
+ ChatMessage(role = "assistant", content = "", reasoning_content = "plan", tool_calls = calls),
+ ChatMessage(role = "tool", content = "42", tool_call_id = "call_1"),
+ ChatMessage(role = "assistant", content = "answer", reasoning_content = "done"),
+ ]
+ out = _build_external_messages(history, True, provider_type = "minimax", model = "MiniMax-M3")
+ replayed = [m.get("reasoning_content") for m in out if m["role"] == "assistant"]
+ assert replayed == ["plan", "done"]
+
+
+def test_studio_tool_loop_replays_minimax_reasoning():
+ from core.inference.external_tool_transport import OAICompatTransport
+ client = ep.ExternalProviderClient("minimax", get_base_url("minimax"), "sk-test")
+ assert OAICompatTransport(client, model = "MiniMax-M3").preserves_reasoning is True
diff --git a/studio/frontend/src/features/chat/external-providers.ts b/studio/frontend/src/features/chat/external-providers.ts
index bbc5282db77..0c037087118 100644
--- a/studio/frontend/src/features/chat/external-providers.ts
+++ b/studio/frontend/src/features/chat/external-providers.ts
@@ -136,6 +136,7 @@ const VISION_CAPABLE_PROVIDER_TYPES = new Set<string>([
"openai",
"anthropic",
"gemini",
+ "minimax",
"openrouter",
]);
diff --git a/studio/frontend/src/features/chat/provider-capabilities.ts b/studio/frontend/src/features/chat/provider-capabilities.ts
index 0b4a634e99e..335ee5fbc6b 100644
--- a/studio/frontend/src/features/chat/provider-capabilities.ts
+++ b/studio/frontend/src/features/chat/provider-capabilities.ts
@@ -655,6 +655,15 @@ const PROVIDER_CAPABILITIES: Record<string, ProviderCapabilities> = {
},
qwen: OPENAI_COMPAT_BASE,
zai: { ...OPENAI_COMPAT_BASE, presencePenalty: false },
+ // Fixed server-side; the backend omits them too.
+ minimax: {
+ temperature: false,
+ topP: false,
+ topK: false,
+ minP: false,
+ repetitionPenalty: false,
+ presencePenalty: false,
+ },
huggingface: OPENAI_COMPAT_BASE,
// OpenRouter silently drops unsupported params, so surface every knob.
openrouter: ALL_SUPPORTED,
@@ -917,6 +926,20 @@ function withReasoningEffortStyle(caps: ReasoningCaps): ExternalReasoningCapabil
};
}
+function resolveMiniMaxReasoningCapabilities(modelId: string): ExternalReasoningCapabilities {
+ if (modelId.startsWith("minimax-m3.1")) {
+ return withReasoningEffortStyle({
+ supportsReasoning: true,
+ supportsReasoningOff: false,
+ reasoningEffortLevels: ["low", "medium", "high", "xhigh", "max"],
+ });
+ }
+ if (modelId === "minimax-m3") {
+ return withEnableThinkingStyle({ supportsReasoning: true, supportsReasoningOff: true });
+ }
+ return withEnableThinkingStyle();
+}
+
function resolveKimiReasoningCapabilities(modelId: string): ExternalReasoningCapabilities {
// Kimi has a boolean thinking toggle, not an effort scale: k2.6 on by default and
// toggleable, k2-thinking always on, k2.5 and others none.
@@ -1273,6 +1296,8 @@ export function getExternalReasoningCapabilities(
? table
: (catalogCapabilities("mistral", normalizedModel) ?? table);
}
+ case "minimax":
+ return resolveMiniMaxReasoningCapabilities(modelForMatching);
case "gemini": {
// Compat gateways drop native thinkingConfig, so hide the ladder.
if (isGeminiCustomOpenAICompatBase(options?.baseUrl)) {
@@ -1346,7 +1371,10 @@ export function providerModelReplaysReasoning(
providerType: string | null | undefined,
modelId: string | null | undefined,
): boolean {
- return providerType === "kimi" && modelId?.trim().toLowerCase() === "kimi-k3";
+ return (
+ providerType === "minimax" ||
+ (providerType === "kimi" && modelId?.trim().toLowerCase() === "kimi-k3")
+ );
}
/** Sent as a llama-server / vLLM template kwarg, so the model's template must still read it. */
diff --git a/studio/frontend/src/features/chat/provider-logo-path.ts b/studio/frontend/src/features/chat/provider-logo-path.ts
index c0b52222748..60872d08ff0 100644
--- a/studio/frontend/src/features/chat/provider-logo-path.ts
+++ b/studio/frontend/src/features/chat/provider-logo-path.ts
@@ -13,6 +13,7 @@ const HUB_PROVIDER_IDS = new Map([
["qwen", "qwen"],
["qwencloud", "qwen"],
["zai", "zai-org"],
+ ["minimax", "minimax"],
]);
const HUB_LOGO_PATHS = new Map(
diff --git a/studio/frontend/tests/external-preserve-thinking.test.ts b/studio/frontend/tests/external-preserve-thinking.test.ts
index c69a6e9f426..9ce41a350cc 100644
--- a/studio/frontend/tests/external-preserve-thinking.test.ts
+++ b/studio/frontend/tests/external-preserve-thinking.test.ts
@@ -70,3 +70,12 @@ test("kimi-k3 replays reasoning whatever the preserve toggle says; k2.6 does not
);
}
});
+
+test("minimax replays reasoning whatever the preserve toggle says", () => {
+ for (const enabled of [true, false]) {
+ assert.deepEqual(
+ evaluate(providerSupportsPreserveThinking, {providerType: "minimax"}, {preserveThinking: enabled}, true, "MiniMax-M3.1-Flash"),
+ {replay: true, fields: {}},
+ );
+ }
+});
diff --git a/studio/frontend/tests/provider-logo-path.test.ts b/studio/frontend/tests/provider-logo-path.test.ts
index b1184e8f858..bf71eeafc2c 100644
--- a/studio/frontend/tests/provider-logo-path.test.ts
+++ b/studio/frontend/tests/provider-logo-path.test.ts
@@ -21,6 +21,7 @@ test("connections use the model hub's canonical provider images", () => {
["qwen", "qwen"],
["qwencloud", "qwen"],
["zai", "zai-org"],
+ ["minimax", "minimax"],
]) {
const hubLogo = PROVIDER_LOGOS.find(({ id }) => id === hubId);
assert.ok(hubLogo, hubId);
@@ -40,7 +41,7 @@ test("every supported connection resolves to an existing public asset", () => {
for (const type of [
"openai", "openai_codex", "deepseek", "mistral", "huggingface", "kimi",
"qwen", "qwencloud", "gemini", "anthropic", "openrouter", "vllm", "ollama", "llama_cpp",
- "liquid", "typesafe", "zai", "opencode", "opencode_go",
+ "liquid", "typesafe", "zai", "minimax", "opencode", "opencode_go",
]) {
const path = providerLogoPath(type);
assert.ok(path?.startsWith("/"), type);