Files
openclaw/extensions/minimax/provider-contract-api.ts
Vinayaka Jyothi 443ac732a1 fix(minimax): keep thinking active for M3
Fix MiniMax-M3 Anthropic-compatible requests so OpenClaw no longer sends the disabled-thinking payload that makes M3 return empty content. M3 defaults now stay on MiniMax's omitted/adaptive thinking path, explicit `/think off` is still respected, and MiniMax-M2.x keeps the disabled-thinking default that prevents reasoning_content leaks.

Also wires the MiniMax thinking policy through bundled provider-policy loading so pre-runtime and configless embedded-agent paths resolve the same defaults.

Thanks @IamVNIE for the live MiniMax API repro and initial patch.
2026-06-06 22:56:17 -07:00

89 lines
2.5 KiB
TypeScript

// Minimax API module exposes the plugin public contract.
import type { ProviderPlugin } from "openclaw/plugin-sdk/provider-model-shared";
import { resolveMinimaxThinkingProfile } from "./thinking.js";
const noopAuth = async () => ({ profiles: [] });
const wizardGroup = {
groupId: "minimax",
groupLabel: "MiniMax",
groupHint: "M3 (recommended)",
} as const;
export function createMinimaxProvider(): ProviderPlugin {
return {
id: "minimax",
label: "MiniMax",
hookAliases: ["minimax-cn"],
docsPath: "/providers/minimax",
envVars: ["MINIMAX_API_KEY"],
resolveThinkingProfile: ({ modelId }) => resolveMinimaxThinkingProfile(modelId),
auth: [
{
id: "api-global",
kind: "api_key",
label: "MiniMax API key (Global)",
hint: "Global endpoint - api.minimax.io",
run: noopAuth,
wizard: {
choiceId: "minimax-global-api",
choiceLabel: "MiniMax API key (Global)",
choiceHint: "Global endpoint - api.minimax.io",
...wizardGroup,
},
},
{
id: "api-cn",
kind: "api_key",
label: "MiniMax API key (CN)",
hint: "CN endpoint - api.minimaxi.com",
run: noopAuth,
wizard: {
choiceId: "minimax-cn-api",
choiceLabel: "MiniMax API key (CN)",
choiceHint: "CN endpoint - api.minimaxi.com",
...wizardGroup,
},
},
],
};
}
export function createMinimaxPortalProvider(): ProviderPlugin {
return {
id: "minimax-portal",
label: "MiniMax",
hookAliases: ["minimax-portal-cn"],
docsPath: "/providers/minimax",
envVars: ["MINIMAX_OAUTH_TOKEN", "MINIMAX_API_KEY"],
resolveThinkingProfile: ({ modelId }) => resolveMinimaxThinkingProfile(modelId),
auth: [
{
id: "oauth",
kind: "device_code",
label: "MiniMax OAuth (Global)",
hint: "Global endpoint - api.minimax.io",
run: noopAuth,
wizard: {
choiceId: "minimax-global-oauth",
choiceLabel: "MiniMax OAuth (Global)",
choiceHint: "Global endpoint - api.minimax.io",
...wizardGroup,
},
},
{
id: "oauth-cn",
kind: "device_code",
label: "MiniMax OAuth (CN)",
hint: "CN endpoint - api.minimaxi.com",
run: noopAuth,
wizard: {
choiceId: "minimax-cn-oauth",
choiceLabel: "MiniMax OAuth (CN)",
choiceHint: "CN endpoint - api.minimaxi.com",
...wizardGroup,
},
},
],
};
}