From e2e9f979cafa5629cbf57500b2c31f71ab1380b7 Mon Sep 17 00:00:00 2001 From: liyuan97 <33855278+liyuan97@users.noreply.github.com> Date: Thu, 26 Mar 2026 00:29:35 +0800 Subject: [PATCH] feat(minimax): add image generation provider and trim model catalog to M2.7 (#54487) * feat(minimax): add image generation and TTS providers, trim TUI model list Register MiniMax image-01 and speech-2.8 models as plugin providers for the image_generate and TTS tools. Both resolve CN/global base URLs from the configured model endpoint origin. - Image generation: base64 response, aspect-ratio support, image-to-image via subject_reference, registered for minimax and minimax-portal - TTS: speech-2.8-turbo (default) and speech-2.8-hd, hex-encoded audio, voice listing via get_voice API, telephony PCM support - Add MiniMax to TTS auto-detection cascade (after ElevenLabs, before Microsoft) and TTS config section - Remove MiniMax-VL-01, M2, M2.1, M2.5 and variants from TUI picker; keep M2.7 and M2.7-highspeed only (backend routing unchanged) * feat(minimax): trim legacy model catalog to M2.7 only Cherry-picked from temp/feat/minimax-trim-legacy-models (949ed28). Removes MiniMax-VL-01, M2, M2.1, M2.5 and variants from the model catalog, model order, modern model matchers, OAuth config, docs, and tests. Keeps only M2.7 and M2.7-highspeed. Conflicts resolved: - provider-catalog.ts: removed MINIMAX_TUI_MODELS filter (no longer needed since source array is now M2.7-only) - index.ts: kept image generation + speech provider registrations (added by this branch), moved media understanding registrations earlier (as intended by the cherry-picked commit) * fix(minimax): update discovery contract test to reflect M2.7-only catalog Cherry-picked from temp/feat/minimax-trim-legacy-models (2c750cb). * feat(minimax): add web search provider and register in plugin entry * fix(minimax): resolve OAuth credentials for TTS speech provider * MiniMax: remove web search and TTS providers * fix(minimax): throw on empty images array after generation failure * feat(minimax): add image generation provider and trim catalog to M2.7 (#54487) (thanks @liyuan97) --------- Co-authored-by: tars90percent Co-authored-by: George Zhang --- CHANGELOG.md | 3 + docs/help/faq.md | 5 +- docs/providers/minimax.md | 68 +------ extensions/minimax/README.md | 4 +- .../minimax/image-generation-provider.ts | 176 ++++++++++++++++++ extensions/minimax/index.ts | 23 +-- extensions/minimax/model-definitions.test.ts | 6 +- extensions/minimax/provider-catalog.ts | 25 +-- ...ssing-provider-apikey-from-env-var.test.ts | 2 - .../models-config.providers.minimax.test.ts | 6 - .../models-config.providers.nvidia.test.ts | 3 - ...s-writing-models-json-no-env-token.test.ts | 2 +- .../pi-embedded-runner-extraparams.test.ts | 8 +- .../minimax-stream-wrappers.ts | 2 - src/agents/tools/image-tool.helpers.ts | 13 +- ...nk-low-reasoning-capable-models-no.test.ts | 2 +- ...tches-fuzzy-selection-is-ambiguous.test.ts | 15 +- src/auto-reply/status.test.ts | 48 ++--- src/commands/onboard-auth.test.ts | 4 +- .../contracts/discovery.contract.test.ts | 2 +- src/plugins/provider-model-minimax.ts | 22 +-- 21 files changed, 247 insertions(+), 192 deletions(-) create mode 100644 extensions/minimax/image-generation-provider.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 623865fc563..42a35ebc02f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ Docs: https://docs.openclaw.ai ### Changes +- MiniMax: add image generation provider for `image-01` model, supporting generate and image-to-image editing with aspect ratio control. (#54487) Thanks @liyuan97. +- MiniMax: trim model catalog to M2.7 only, removing legacy M2, M2.1, M2.5, and VL-01 models. (#54487) Thanks @liyuan97. + ### Fixes - Agents/sandbox: honor `tools.sandbox.tools.alsoAllow`, let explicit sandbox re-allows remove matching built-in default-deny tools, and keep sandbox explain/error guidance aligned with the effective sandbox tool policy. (#54492) Thanks @ngutman. diff --git a/docs/help/faq.md b/docs/help/faq.md index b3209c37124..85ed47b6409 100644 --- a/docs/help/faq.md +++ b/docs/help/faq.md @@ -2153,9 +2153,8 @@ Quick answers plus deeper troubleshooting for real-world setups (local dev, VPS, 1. Upgrade to a current OpenClaw release (or run from source `main`), then restart the gateway. 2. Make sure MiniMax is configured (wizard or JSON), or that a MiniMax API key exists in env/auth profiles so the provider can be injected. - 3. Use the exact model id (case-sensitive): `minimax/MiniMax-M2.7`, - `minimax/MiniMax-M2.7-highspeed`, `minimax/MiniMax-M2.5`, or - `minimax/MiniMax-M2.5-highspeed`. + 3. Use the exact model id (case-sensitive): `minimax/MiniMax-M2.7` or + `minimax/MiniMax-M2.7-highspeed`. 4. Run: ```bash diff --git a/docs/providers/minimax.md b/docs/providers/minimax.md index f04c3984c3f..62f19d9869a 100644 --- a/docs/providers/minimax.md +++ b/docs/providers/minimax.md @@ -8,16 +8,12 @@ title: "MiniMax" # MiniMax -OpenClaw's MiniMax provider defaults to **MiniMax M2.7** and keeps -**MiniMax M2.5** in the catalog for compatibility. +OpenClaw's MiniMax provider defaults to **MiniMax M2.7**. ## Model lineup - `MiniMax-M2.7`: default hosted text model. - `MiniMax-M2.7-highspeed`: faster M2.7 text tier. -- `MiniMax-M2.5`: previous text model, still available in the MiniMax catalog. -- `MiniMax-M2.5-highspeed`: faster M2.5 text tier. -- `MiniMax-VL-01`: vision model for text + image inputs. ## Choose a setup @@ -80,24 +76,6 @@ Configure via CLI: contextWindow: 200000, maxTokens: 8192, }, - { - id: "MiniMax-M2.5", - name: "MiniMax M2.5", - reasoning: true, - input: ["text"], - cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.12 }, - contextWindow: 200000, - maxTokens: 8192, - }, - { - id: "MiniMax-M2.5-highspeed", - name: "MiniMax M2.5 Highspeed", - reasoning: true, - input: ["text"], - cost: { input: 0.3, output: 1.2, cacheRead: 0.03, cacheWrite: 0.12 }, - contextWindow: 200000, - maxTokens: 8192, - }, ], }, }, @@ -128,46 +106,6 @@ Example below uses Opus as a concrete primary; swap to your preferred latest-gen } ``` -### Optional: Local via LM Studio (manual) - -**Best for:** local inference with LM Studio. -We have seen strong results with MiniMax M2.5 on powerful hardware (e.g. a -desktop/server) using LM Studio's local server. - -Configure manually via `openclaw.json`: - -```json5 -{ - agents: { - defaults: { - model: { primary: "lmstudio/minimax-m2.5-gs32" }, - models: { "lmstudio/minimax-m2.5-gs32": { alias: "Minimax" } }, - }, - }, - models: { - mode: "merge", - providers: { - lmstudio: { - baseUrl: "http://127.0.0.1:1234/v1", - apiKey: "lmstudio", - api: "openai-responses", - models: [ - { - id: "minimax-m2.5-gs32", - name: "MiniMax M2.5 GS32", - reasoning: true, - input: ["text"], - cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, - contextWindow: 196608, - maxTokens: 8192, - }, - ], - }, - }, - }, -} -``` - ## Configure via `openclaw configure` Use the interactive config wizard to set MiniMax without editing JSON: @@ -190,7 +128,7 @@ Use the interactive config wizard to set MiniMax without editing JSON: - Model refs are `minimax/`. - Default text model: `MiniMax-M2.7`. -- Alternate text models: `MiniMax-M2.7-highspeed`, `MiniMax-M2.5`, `MiniMax-M2.5-highspeed`. +- Alternate text model: `MiniMax-M2.7-highspeed`. - Coding Plan usage API: `https://api.minimaxi.com/v1/api/openplatform/coding_plan/remains` (requires a coding plan key). - Update pricing values in `models.json` if you need exact cost tracking. - Referral link for MiniMax Coding Plan (10% off): [https://platform.minimax.io/subscribe/coding-plan?code=DbXJTRClnb&source=link](https://platform.minimax.io/subscribe/coding-plan?code=DbXJTRClnb&source=link) @@ -214,8 +152,6 @@ Make sure the model id is **case‑sensitive**: - `minimax/MiniMax-M2.7` - `minimax/MiniMax-M2.7-highspeed` -- `minimax/MiniMax-M2.5` -- `minimax/MiniMax-M2.5-highspeed` Then recheck with: diff --git a/extensions/minimax/README.md b/extensions/minimax/README.md index fa343894525..f64628ec2bb 100644 --- a/extensions/minimax/README.md +++ b/extensions/minimax/README.md @@ -3,7 +3,7 @@ Bundled MiniMax plugin for both: - API-key provider setup (`minimax`) -- Coding Plan OAuth setup (`minimax-portal`) +- Token Plan OAuth setup (`minimax-portal`) ## Enable @@ -34,4 +34,4 @@ openclaw setup --wizard --auth-choice minimax-global-api ## Notes - MiniMax OAuth uses a user-code login flow. -- OAuth currently targets the Coding Plan path. +- OAuth currently targets the Token Plan path. diff --git a/extensions/minimax/image-generation-provider.ts b/extensions/minimax/image-generation-provider.ts new file mode 100644 index 00000000000..143efc0759f --- /dev/null +++ b/extensions/minimax/image-generation-provider.ts @@ -0,0 +1,176 @@ +import type { ImageGenerationProvider } from "openclaw/plugin-sdk/image-generation"; +import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth"; + +const DEFAULT_MINIMAX_IMAGE_BASE_URL = "https://api.minimax.io"; +const DEFAULT_MODEL = "image-01"; +const DEFAULT_OUTPUT_MIME = "image/png"; +const MINIMAX_SUPPORTED_ASPECT_RATIOS = [ + "1:1", + "16:9", + "4:3", + "3:2", + "2:3", + "3:4", + "9:16", + "21:9", +] as const; + +type MinimaxImageApiResponse = { + data?: { + image_base64?: string[]; + }; + metadata?: { + success_count?: number; + failed_count?: number; + }; + id?: string; + base_resp?: { + status_code?: number; + status_msg?: string; + }; +}; + +function resolveMinimaxImageBaseUrl( + cfg: Parameters[0]["cfg"], + providerId: string, +): string { + const direct = cfg?.models?.providers?.[providerId]?.baseUrl?.trim(); + if (!direct) { + return DEFAULT_MINIMAX_IMAGE_BASE_URL; + } + // Extract origin from the configured base URL (which may include path like /anthropic) + try { + return new URL(direct).origin; + } catch { + return DEFAULT_MINIMAX_IMAGE_BASE_URL; + } +} + +function buildMinimaxImageProvider(providerId: string): ImageGenerationProvider { + return { + id: providerId, + label: "MiniMax", + defaultModel: DEFAULT_MODEL, + models: [DEFAULT_MODEL], + capabilities: { + generate: { + maxCount: 9, + supportsSize: false, + supportsAspectRatio: true, + supportsResolution: false, + }, + edit: { + enabled: true, + maxCount: 9, + maxInputImages: 1, + supportsSize: false, + supportsAspectRatio: true, + supportsResolution: false, + }, + geometry: { + aspectRatios: [...MINIMAX_SUPPORTED_ASPECT_RATIOS], + }, + }, + async generateImage(req) { + const auth = await resolveApiKeyForProvider({ + provider: providerId, + cfg: req.cfg, + agentDir: req.agentDir, + store: req.authStore, + }); + if (!auth.apiKey) { + throw new Error("MiniMax API key missing"); + } + + const baseUrl = resolveMinimaxImageBaseUrl(req.cfg, providerId); + + const body: Record = { + model: req.model || DEFAULT_MODEL, + prompt: req.prompt, + response_format: "base64", + n: req.count ?? 1, + }; + + if (req.aspectRatio?.trim()) { + body.aspect_ratio = req.aspectRatio.trim(); + } + + // Map input images to subject_reference for image-to-image generation + if (req.inputImages && req.inputImages.length > 0) { + const ref = req.inputImages[0]; + const mime = ref.mimeType || "image/jpeg"; + const dataUrl = `data:${mime};base64,${ref.buffer.toString("base64")}`; + body.subject_reference = [{ type: "character", image_file: dataUrl }]; + } + + const controller = new AbortController(); + const timeoutMs = req.timeoutMs; + const timeout = + typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0 + ? setTimeout(() => controller.abort(), timeoutMs) + : undefined; + + const response = await fetch(`${baseUrl}/v1/image_generation`, { + method: "POST", + headers: { + Authorization: `Bearer ${auth.apiKey}`, + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + signal: controller.signal, + }).finally(() => { + clearTimeout(timeout); + }); + + if (!response.ok) { + const text = await response.text().catch(() => ""); + throw new Error( + `MiniMax image generation failed (${response.status}): ${text || response.statusText}`, + ); + } + + const data = (await response.json()) as MinimaxImageApiResponse; + + const baseResp = data.base_resp; + if (baseResp && typeof baseResp.status_code === "number" && baseResp.status_code !== 0) { + const msg = baseResp.status_msg ?? ""; + throw new Error(`MiniMax image generation API error (${baseResp.status_code}): ${msg}`); + } + + const base64Images = data.data?.image_base64 ?? []; + const failedCount = data.metadata?.failed_count ?? 0; + + if (base64Images.length === 0) { + const reason = + failedCount > 0 ? `${failedCount} image(s) failed to generate` : "no images returned"; + throw new Error(`MiniMax image generation returned no images: ${reason}`); + } + + const images = base64Images + .map((b64, index) => { + if (!b64) { + return null; + } + return { + buffer: Buffer.from(b64, "base64"), + mimeType: DEFAULT_OUTPUT_MIME, + fileName: `image-${index + 1}.png`, + }; + }) + .filter((entry): entry is NonNullable => entry !== null); + + return { + images, + model: req.model || DEFAULT_MODEL, + }; + }, + }; +} + +export function buildMinimaxImageGenerationProvider(): ImageGenerationProvider { + return buildMinimaxImageProvider("minimax"); +} + +export function buildMinimaxPortalImageGenerationProvider(): ImageGenerationProvider { + return buildMinimaxImageProvider("minimax-portal"); +} diff --git a/extensions/minimax/index.ts b/extensions/minimax/index.ts index 6ea1f41aa48..640ee9c3fa9 100644 --- a/extensions/minimax/index.ts +++ b/extensions/minimax/index.ts @@ -16,6 +16,10 @@ import { MINIMAX_DEFAULT_MODEL_ID, } from "openclaw/plugin-sdk/provider-models"; import { fetchMinimaxUsage } from "openclaw/plugin-sdk/provider-usage"; +import { + buildMinimaxImageGenerationProvider, + buildMinimaxPortalImageGenerationProvider, +} from "./image-generation-provider.js"; import { minimaxMediaUnderstandingProvider, minimaxPortalMediaUnderstandingProvider, @@ -130,22 +134,10 @@ function createOAuthHandler(region: MiniMaxRegion) { agents: { defaults: { models: { - [portalModelRef("MiniMax-M2")]: { alias: "minimax-m2" }, - [portalModelRef("MiniMax-M2.1")]: { alias: "minimax-m2.1" }, - [portalModelRef("MiniMax-M2.1-highspeed")]: { - alias: "minimax-m2.1-highspeed", - }, [portalModelRef("MiniMax-M2.7")]: { alias: "minimax-m2.7" }, [portalModelRef("MiniMax-M2.7-highspeed")]: { alias: "minimax-m2.7-highspeed", }, - [portalModelRef("MiniMax-M2.5")]: { alias: "minimax-m2.5" }, - [portalModelRef("MiniMax-M2.5-highspeed")]: { - alias: "minimax-m2.5-highspeed", - }, - [portalModelRef("MiniMax-M2.5-Lightning")]: { - alias: "minimax-m2.5-lightning", - }, }, }, }, @@ -243,6 +235,9 @@ export default definePluginEntry({ await fetchMinimaxUsage(ctx.token, ctx.timeoutMs, ctx.fetchFn), }); + api.registerMediaUnderstandingProvider(minimaxMediaUnderstandingProvider); + api.registerMediaUnderstandingProvider(minimaxPortalMediaUnderstandingProvider); + api.registerProvider({ id: PORTAL_PROVIDER_ID, label: PROVIDER_LABEL, @@ -285,7 +280,7 @@ export default definePluginEntry({ ], isModernModelRef: ({ modelId }) => isMiniMaxModernModelId(modelId), }); - api.registerMediaUnderstandingProvider(minimaxMediaUnderstandingProvider); - api.registerMediaUnderstandingProvider(minimaxPortalMediaUnderstandingProvider); + api.registerImageGenerationProvider(buildMinimaxImageGenerationProvider()); + api.registerImageGenerationProvider(buildMinimaxPortalImageGenerationProvider()); }, }); diff --git a/extensions/minimax/model-definitions.test.ts b/extensions/minimax/model-definitions.test.ts index 8130caa39b9..ddc46187d4e 100644 --- a/extensions/minimax/model-definitions.test.ts +++ b/extensions/minimax/model-definitions.test.ts @@ -26,14 +26,14 @@ describe("minimax model definitions", () => { it("builds catalog model with name and reasoning from catalog", () => { const model = buildMinimaxModelDefinition({ - id: "MiniMax-M2.1", + id: "MiniMax-M2.7", cost: MINIMAX_API_COST, contextWindow: DEFAULT_MINIMAX_CONTEXT_WINDOW, maxTokens: DEFAULT_MINIMAX_MAX_TOKENS, }); expect(model).toMatchObject({ - id: "MiniMax-M2.1", - name: "MiniMax M2.1", + id: "MiniMax-M2.7", + name: "MiniMax M2.7", reasoning: true, }); }); diff --git a/extensions/minimax/provider-catalog.ts b/extensions/minimax/provider-catalog.ts index b0e62853e19..8d43881c548 100644 --- a/extensions/minimax/provider-catalog.ts +++ b/extensions/minimax/provider-catalog.ts @@ -9,7 +9,6 @@ import { } from "openclaw/plugin-sdk/provider-models"; const MINIMAX_PORTAL_BASE_URL = "https://api.minimax.io/anthropic"; -const MINIMAX_DEFAULT_VISION_MODEL_ID = "MiniMax-VL-01"; const MINIMAX_DEFAULT_CONTEXT_WINDOW = 204800; const MINIMAX_DEFAULT_MAX_TOKENS = 131072; const MINIMAX_API_COST = { @@ -45,22 +44,14 @@ function buildMinimaxTextModel(params: { } function buildMinimaxCatalog(): ModelDefinitionConfig[] { - return [ - buildMinimaxModel({ - id: MINIMAX_DEFAULT_VISION_MODEL_ID, - name: "MiniMax VL 01", - reasoning: false, - input: ["text", "image"], - }), - ...MINIMAX_TEXT_MODEL_ORDER.map((id) => { - const model = MINIMAX_TEXT_MODEL_CATALOG[id]; - return buildMinimaxTextModel({ - id, - name: model.name, - reasoning: model.reasoning, - }); - }), - ]; + return MINIMAX_TEXT_MODEL_ORDER.map((id) => { + const model = MINIMAX_TEXT_MODEL_CATALOG[id]; + return buildMinimaxTextModel({ + id, + name: model.name, + reasoning: model.reasoning, + }); + }); } export function buildMinimaxProvider(): ModelProviderConfig { diff --git a/src/agents/models-config.fills-missing-provider-apikey-from-env-var.test.ts b/src/agents/models-config.fills-missing-provider-apikey-from-env-var.test.ts index e818616caff..ed7daf54530 100644 --- a/src/agents/models-config.fills-missing-provider-apikey-from-env-var.test.ts +++ b/src/agents/models-config.fills-missing-provider-apikey-from-env-var.test.ts @@ -329,8 +329,6 @@ describe("models-config", () => { providers: Record }>; }>(); expect(parsed.providers.minimax?.apiKey).toBe("MINIMAX_API_KEY"); // pragma: allowlist secret - const ids = parsed.providers.minimax?.models?.map((model) => model.id); - expect(ids).toContain("MiniMax-VL-01"); }); }); }); diff --git a/src/agents/models-config.providers.minimax.test.ts b/src/agents/models-config.providers.minimax.test.ts index b3e3ea1e5c2..e4d31e05af2 100644 --- a/src/agents/models-config.providers.minimax.test.ts +++ b/src/agents/models-config.providers.minimax.test.ts @@ -36,18 +36,12 @@ describe("minimax provider catalog", () => { const providers = await resolveImplicitProvidersForTest({ agentDir }); expect(providers?.minimax?.models?.map((model) => model.id)).toEqual([ - "MiniMax-VL-01", "MiniMax-M2.7", "MiniMax-M2.7-highspeed", - "MiniMax-M2.5", - "MiniMax-M2.5-highspeed", ]); expect(providers?.["minimax-portal"]?.models?.map((model) => model.id)).toEqual([ - "MiniMax-VL-01", "MiniMax-M2.7", "MiniMax-M2.7-highspeed", - "MiniMax-M2.5", - "MiniMax-M2.5-highspeed", ]); }); }); diff --git a/src/agents/models-config.providers.nvidia.test.ts b/src/agents/models-config.providers.nvidia.test.ts index 11a291bf69f..bfa70c5bb41 100644 --- a/src/agents/models-config.providers.nvidia.test.ts +++ b/src/agents/models-config.providers.nvidia.test.ts @@ -94,9 +94,6 @@ describe("MiniMax implicit provider (#15275)", () => { const providers = await resolveImplicitProvidersForTest({ agentDir }); expect(providers?.["minimax-portal"]).toBeDefined(); expect(providers?.["minimax-portal"]?.authHeader).toBe(true); - expect(providers?.["minimax-portal"]?.models?.some((m) => m.id === "MiniMax-VL-01")).toBe( - true, - ); }); }); }); diff --git a/src/agents/models-config.skips-writing-models-json-no-env-token.test.ts b/src/agents/models-config.skips-writing-models-json-no-env-token.test.ts index 5014072d2ad..15834b2782c 100644 --- a/src/agents/models-config.skips-writing-models-json-no-env-token.test.ts +++ b/src/agents/models-config.skips-writing-models-json-no-env-token.test.ts @@ -207,7 +207,7 @@ describe("models-config", () => { providerKey: "minimax", expectedBaseUrl: "https://api.minimax.io/anthropic", expectedApiKeyRef: "MINIMAX_API_KEY", // pragma: allowlist secret - expectedModelIds: ["MiniMax-M2.7", "MiniMax-VL-01"], + expectedModelIds: ["MiniMax-M2.7"], }); }); }); diff --git a/src/agents/pi-embedded-runner-extraparams.test.ts b/src/agents/pi-embedded-runner-extraparams.test.ts index 12fc28bdd44..e36f6881c63 100644 --- a/src/agents/pi-embedded-runner-extraparams.test.ts +++ b/src/agents/pi-embedded-runner-extraparams.test.ts @@ -1940,20 +1940,20 @@ describe("applyExtraParamsToAgent", () => { expect(resolvedModelId).toBe("MiniMax-M2.7-highspeed"); }); - it("maps MiniMax M2.1 /fast to the matching highspeed model", () => { + it("maps MiniMax M2.7 /fast to the matching highspeed model", () => { const resolvedModelId = runResolvedModelIdCase({ applyProvider: "minimax", - applyModelId: "MiniMax-M2.1", + applyModelId: "MiniMax-M2.7", extraParamsOverride: { fastMode: true }, model: { api: "anthropic-messages", provider: "minimax", - id: "MiniMax-M2.1", + id: "MiniMax-M2.7", baseUrl: "https://api.minimax.io/anthropic", } as Model<"anthropic-messages">, }); - expect(resolvedModelId).toBe("MiniMax-M2.1-highspeed"); + expect(resolvedModelId).toBe("MiniMax-M2.7-highspeed"); }); it("keeps explicit MiniMax highspeed models unchanged when /fast is off", () => { diff --git a/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts b/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts index 89832f2903b..e8f83c809fa 100644 --- a/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts +++ b/src/agents/pi-embedded-runner/minimax-stream-wrappers.ts @@ -2,8 +2,6 @@ import type { StreamFn } from "@mariozechner/pi-agent-core"; import { streamSimple } from "@mariozechner/pi-ai"; const MINIMAX_FAST_MODEL_IDS = new Map([ - ["MiniMax-M2.1", "MiniMax-M2.1-highspeed"], - ["MiniMax-M2.5", "MiniMax-M2.5-highspeed"], ["MiniMax-M2.7", "MiniMax-M2.7-highspeed"], ]); diff --git a/src/agents/tools/image-tool.helpers.ts b/src/agents/tools/image-tool.helpers.ts index f0e088b4092..2fbd5edd611 100644 --- a/src/agents/tools/image-tool.helpers.ts +++ b/src/agents/tools/image-tool.helpers.ts @@ -63,18 +63,7 @@ export function resolveProviderVisionModelFromConfig(params: { | { models?: Array<{ id?: string; input?: string[] }> } | undefined; const models = providerCfg?.models ?? []; - const preferMinimaxVl = - params.provider === "minimax" - ? models.find( - (m) => - (m?.id ?? "").trim() === "MiniMax-VL-01" && - Array.isArray(m?.input) && - m.input.includes("image"), - ) - : null; - const picked = - preferMinimaxVl ?? - models.find((m) => Boolean((m?.id ?? "").trim()) && m.input?.includes("image")); + const picked = models.find((m) => Boolean((m?.id ?? "").trim()) && m.input?.includes("image")); const id = (picked?.id ?? "").trim(); return id ? `${params.provider}/${id}` : null; } diff --git a/src/auto-reply/reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts b/src/auto-reply/reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts index efaab148f63..07a1a66aad5 100644 --- a/src/auto-reply/reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts +++ b/src/auto-reply/reply.directive.directive-behavior.defaults-think-low-reasoning-capable-models-no.test.ts @@ -244,7 +244,7 @@ describe("directive behavior", () => { api: "anthropic-messages", models: [ { id: "MiniMax-M2.7", name: "MiniMax M2.7" }, - { id: "MiniMax-M2.5", name: "MiniMax M2.5" }, + { id: "MiniMax-M2.7-highspeed", name: "MiniMax M2.7 Highspeed" }, ], }, }, diff --git a/src/auto-reply/reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts b/src/auto-reply/reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts index 4d442cb4429..c16643e5170 100644 --- a/src/auto-reply/reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts +++ b/src/auto-reply/reply.directive.directive-behavior.prefers-alias-matches-fuzzy-selection-is-ambiguous.test.ts @@ -124,8 +124,7 @@ describe("directive behavior", () => { workspace: path.join(home, "openclaw"), models: { "minimax/MiniMax-M2.7": {}, - "minimax/MiniMax-M2.5": {}, - "minimax/MiniMax-M2.5-highspeed": {}, + "minimax/MiniMax-M2.7-highspeed": {}, "lmstudio/minimax-m2.5-gs32": {}, }, }, @@ -139,7 +138,7 @@ describe("directive behavior", () => { api: "anthropic-messages", models: [ makeModelDefinition("MiniMax-M2.7", "MiniMax M2.7"), - makeModelDefinition("MiniMax-M2.5", "MiniMax M2.5"), + makeModelDefinition("MiniMax-M2.7-highspeed", "MiniMax M2.7 Highspeed"), ], }, lmstudio: { @@ -153,11 +152,11 @@ describe("directive behavior", () => { }, }, { - body: "/model minimax/m2.5", + body: "/model minimax/highspeed", storePath: path.join(home, "sessions-provider-fuzzy.json"), expectedSelection: { provider: "minimax", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7-highspeed", }, config: { agents: { @@ -166,8 +165,7 @@ describe("directive behavior", () => { workspace: path.join(home, "openclaw"), models: { "minimax/MiniMax-M2.7": {}, - "minimax/MiniMax-M2.5": {}, - "minimax/MiniMax-M2.5-highspeed": {}, + "minimax/MiniMax-M2.7-highspeed": {}, }, }, }, @@ -180,8 +178,7 @@ describe("directive behavior", () => { api: "anthropic-messages", models: [ makeModelDefinition("MiniMax-M2.7", "MiniMax M2.7"), - makeModelDefinition("MiniMax-M2.5", "MiniMax M2.5"), - makeModelDefinition("MiniMax-M2.5-highspeed", "MiniMax M2.5 Highspeed"), + makeModelDefinition("MiniMax-M2.7-highspeed", "MiniMax M2.7 Highspeed"), ], }, }, diff --git a/src/auto-reply/status.test.ts b/src/auto-reply/status.test.ts index adf354dc1d6..06ebd3250be 100644 --- a/src/auto-reply/status.test.ts +++ b/src/auto-reply/status.test.ts @@ -231,7 +231,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 1_048_576 }], @@ -248,9 +248,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, contextTokens: 1_048_576, @@ -263,7 +263,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/200k"); expect(normalized).not.toContain("Context: 49k/1.0m"); }); @@ -274,7 +274,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 1_048_576 }], @@ -292,9 +292,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, contextTokens: 1_048_576, @@ -307,7 +307,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/123k"); expect(normalized).not.toContain("Context: 49k/1.0m"); expect(normalized).not.toContain("Context: 49k/200k"); @@ -319,7 +319,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 1_048_576 }], @@ -336,9 +336,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, contextTokens: 123_456, @@ -351,7 +351,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/123k"); expect(normalized).not.toContain("Context: 49k/1.0m"); expect(normalized).not.toContain("Context: 49k/200k"); @@ -363,7 +363,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 1_048_576 }], @@ -382,9 +382,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, }, @@ -396,7 +396,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/120k"); expect(normalized).not.toContain("Context: 49k/200k"); expect(normalized).not.toContain("Context: 49k/1.0m"); @@ -408,7 +408,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 128_000 }], @@ -427,9 +427,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, }, @@ -441,7 +441,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/128k"); expect(normalized).not.toContain("Context: 49k/200k"); }); @@ -452,7 +452,7 @@ describe("buildStatusMessage", () => { models: { providers: { "minimax-portal": { - models: [{ id: "MiniMax-M2.5", contextWindow: 200_000 }], + models: [{ id: "MiniMax-M2.7", contextWindow: 200_000 }], }, xiaomi: { models: [{ id: "mimo-v2-flash", contextWindow: 1_048_576 }], @@ -471,9 +471,9 @@ describe("buildStatusMessage", () => { providerOverride: "xiaomi", modelOverride: "mimo-v2-flash", modelProvider: "minimax-portal", - model: "MiniMax-M2.5", + model: "MiniMax-M2.7", fallbackNoticeSelectedModel: "xiaomi/mimo-v2-flash", - fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.5", + fallbackNoticeActiveModel: "minimax-portal/MiniMax-M2.7", fallbackNoticeReason: "model not allowed", totalTokens: 49_000, }, @@ -485,7 +485,7 @@ describe("buildStatusMessage", () => { }); const normalized = normalizeTestText(text); - expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.5"); + expect(normalized).toContain("Fallback: minimax-portal/MiniMax-M2.7"); expect(normalized).toContain("Context: 49k/200k"); expect(normalized).not.toContain("Context: 49k/1.0m"); }); diff --git a/src/commands/onboard-auth.test.ts b/src/commands/onboard-auth.test.ts index 21463522849..0cbbca2276c 100644 --- a/src/commands/onboard-auth.test.ts +++ b/src/commands/onboard-auth.test.ts @@ -551,8 +551,8 @@ describe("primary model defaults", () => { it("sets correct primary model", () => { const configCases = [ { - getConfig: () => applyMinimaxApiConfig({}, "MiniMax-M2.5-highspeed"), - primaryModel: "minimax/MiniMax-M2.5-highspeed", + getConfig: () => applyMinimaxApiConfig({}, "MiniMax-M2.7-highspeed"), + primaryModel: "minimax/MiniMax-M2.7-highspeed", }, { getConfig: () => applyZaiConfig({}, { modelId: "glm-5" }), diff --git a/src/plugins/contracts/discovery.contract.test.ts b/src/plugins/contracts/discovery.contract.test.ts index 546bcbe25ff..f0accc1d526 100644 --- a/src/plugins/contracts/discovery.contract.test.ts +++ b/src/plugins/contracts/discovery.contract.test.ts @@ -457,7 +457,7 @@ describe("provider discovery contract", () => { apiKey: "minimax-key", models: expect.arrayContaining([ expect.objectContaining({ id: "MiniMax-M2.7" }), - expect.objectContaining({ id: "MiniMax-VL-01" }), + expect.objectContaining({ id: "MiniMax-M2.7-highspeed" }), ]), }, }); diff --git a/src/plugins/provider-model-minimax.ts b/src/plugins/provider-model-minimax.ts index 6ff7a4f1f56..2337771694a 100644 --- a/src/plugins/provider-model-minimax.ts +++ b/src/plugins/provider-model-minimax.ts @@ -3,36 +3,18 @@ import { matchesExactOrPrefix } from "./provider-model-helpers.js"; export const MINIMAX_DEFAULT_MODEL_ID = "MiniMax-M2.7"; export const MINIMAX_DEFAULT_MODEL_REF = `minimax/${MINIMAX_DEFAULT_MODEL_ID}`; -export const MINIMAX_TEXT_MODEL_ORDER = [ - "MiniMax-M2", - "MiniMax-M2.1", - "MiniMax-M2.1-highspeed", - "MiniMax-M2.7", - "MiniMax-M2.7-highspeed", - "MiniMax-M2.5", - "MiniMax-M2.5-highspeed", -] as const; +export const MINIMAX_TEXT_MODEL_ORDER = ["MiniMax-M2.7", "MiniMax-M2.7-highspeed"] as const; export const MINIMAX_TEXT_MODEL_CATALOG = { - "MiniMax-M2": { name: "MiniMax M2", reasoning: true }, - "MiniMax-M2.1": { name: "MiniMax M2.1", reasoning: true }, - "MiniMax-M2.1-highspeed": { name: "MiniMax M2.1 Highspeed", reasoning: true }, "MiniMax-M2.7": { name: "MiniMax M2.7", reasoning: true }, "MiniMax-M2.7-highspeed": { name: "MiniMax M2.7 Highspeed", reasoning: true }, - "MiniMax-M2.5": { name: "MiniMax M2.5", reasoning: true }, - "MiniMax-M2.5-highspeed": { name: "MiniMax M2.5 Highspeed", reasoning: true }, } as const; export const MINIMAX_TEXT_MODEL_REFS = MINIMAX_TEXT_MODEL_ORDER.map( (modelId) => `minimax/${modelId}`, ); -export const MINIMAX_MODERN_MODEL_MATCHERS = [ - "minimax-m2", - "minimax-m2.1", - "minimax-m2.5", - "minimax-m2.7", -] as const; +export const MINIMAX_MODERN_MODEL_MATCHERS = ["minimax-m2.7"] as const; export function isMiniMaxModernModelId(modelId: string): boolean { return matchesExactOrPrefix(modelId, MINIMAX_MODERN_MODEL_MATCHERS);