From 15d536a3d0de81c13148f4a4fca4244b31b2ab97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=98=AF?= Date: Thu, 22 Oct 2026 02:02:13 +0800 Subject: [PATCH] minimax 0.1.3: the M3 family's real context and output limits (#250) MiniMax Code's model list says 512K context / 128K output for MiniMax-M3, M3.1-Flash and M3.1-Flash-Preview (confirmed: GET /mavis/api/v1/models on agent.minimax.io and agent.minimax.cn answers that with no token). The author measured 1,048,576 input / 524,288 output on a live account on both sites. VERIFIED_LIMITS gives those three ids the measured pair in both the built-in list and the live list; M2.7 keeps what the list says. minimax 0.1.3. Run at head 20662230ca45eca72dab2d77f28631ef6e670718 (review, 10-22): - packages/minimax, sandbox HOME: 51 pass, 0 fail. - The two new/changed tests with origin/main's index.mjs: 2 fail (red without the change). - Head merged onto origin/main: full bun test 2076 pass, 0 fail; bun scripts/check.mjs ok. - Diff read in full: no new hosts, headers or credential handling. Not tried: the live limits were not re-measured here (no real account used). The output cap matches models.dev's minimax-cn entry (524,288). Whether input + max_tokens is checked against the window was not measured; any request that fit under the old 512K/128K still fits. The override wins over the live list, so a later vendor change to these ids needs a plugin release. --- packages/minimax/README.md | 18 +++++++++++------ packages/minimax/index.mjs | 34 ++++++++++++++++++++++++++++---- packages/minimax/models.test.mjs | 27 ++++++++++++++++++++++++- packages/minimax/package.json | 2 +- 4 files changed, 69 insertions(+), 12 deletions(-) diff --git a/packages/minimax/README.md b/packages/minimax/README.md index 9b2afd5..e3a9349 100644 --- a/packages/minimax/README.md +++ b/packages/minimax/README.md @@ -85,12 +85,18 @@ config (`GET /mavis/api/v1/models`). The list includes each model's context, image input and thinking options. If the live list doesn't answer, this built-in list is used instead: -| Model | Context | Images | Reasoning levels (variants) | -|---|---|---|---| -| MiniMax-M3.1-Flash-Preview | 512K | yes | low, medium, high, xhigh, max | -| MiniMax-M3 | 512K | yes | none, high | -| MiniMax-M2.7 | 200K | no | — (always thinks) | -| MiniMax-M2.7-highspeed | 200K | no | — (always thinks) | +| Model | Context | Output | Images | Reasoning levels (variants) | +|---|---|---|---|---| +| MiniMax-M3.1-Flash-Preview | 1M | 512K | yes | low, medium, high, xhigh, max | +| MiniMax-M3 | 1M | 512K | yes | none, high | +| MiniMax-M2.7 | 200K | 128K | no | — (always thinks) | +| MiniMax-M2.7-highspeed | 200K | 128K | no | — (always thinks) | + +MiniMax Code's own list reports 512K/128K for the M3 family, but the +endpoint accepts 1,048,576 input tokens and 524,288 output tokens for +every one of them, so those are the limits given here. An agent that +believed the advertised ones would compact its history about half way too +early. Variants map to what MiniMax Code sends: - a level is adaptive thinking at that effort, which becomes diff --git a/packages/minimax/index.mjs b/packages/minimax/index.mjs index 2e3a597..a909eb9 100644 --- a/packages/minimax/index.mjs +++ b/packages/minimax/index.mjs @@ -65,11 +65,37 @@ const num = (v) => { // ---- the models ------------------------------------------------------------- +// The limits the endpoint really allows, for the models whose advertised +// ones are MiniMax Code's conservative declaration. Its model config says +// 512K/128K for the M3 family, but the endpoint accepts 1,048,576 input +// tokens and 524,288 output tokens for every one of them: a request of +// 1,048,140 input tokens is answered, one of 1,048,700 is refused with +// "context window exceeds limit (2013)", and max_tokens of 524,288 is +// accepted where 600,000 is refused with "does not support max tokens > +// 524288". The advertised numbers are the same for a signed-in account and +// for nobody, so they are not a plan's limit, and an agent that believes +// them compacts its history about half way too early. +const VERIFIED_LIMITS = { + "MiniMax-M3.1-Flash": { context: 1048576, output: 524288 }, + "MiniMax-M3.1-Flash-Preview": { context: 1048576, output: 524288 }, + "MiniMax-M3": { context: 1048576, output: 524288 }, +} + +// limits is a model's context and output: the verified ones where they are +// known, the advertised ones otherwise. +function limits(id, context, output) { + const v = VERIFIED_LIMITS[id] + return { + context: v ? v.context : context ?? 0, + output: v ? v.output : output ?? 0, + } +} + // MiniMax Code's own list, for when the live one can't be had. // thinking: "switchable" (on or off), "forced_on" (always on, at an effort) const MODELS = [ - { id: "MiniMax-M3.1-Flash-Preview", name: "M3.1-Flash-Preview", context: 512000, output: 128000, images: true, thinking: "forced_on", efforts: ["low", "medium", "high", "xhigh", "max"] }, - { id: "MiniMax-M3", name: "MiniMax-M3", context: 512000, output: 128000, images: true, thinking: "switchable", efforts: [] }, + { id: "MiniMax-M3.1-Flash-Preview", name: "M3.1-Flash-Preview", context: 1048576, output: 524288, images: true, thinking: "forced_on", efforts: ["low", "medium", "high", "xhigh", "max"] }, + { id: "MiniMax-M3", name: "MiniMax-M3", context: 1048576, output: 524288, images: true, thinking: "switchable", efforts: [] }, { id: "MiniMax-M2.7", name: "MiniMax-M2.7", context: 200000, output: 128000, images: false, thinking: "on", efforts: [] }, { id: "MiniMax-M2.7-highspeed", name: "MiniMax-M2.7-highspeed", context: 200000, output: 128000, images: false, thinking: "on", efforts: [] }, ] @@ -94,7 +120,7 @@ function configModels() { tool_call: true, attachment: !!m.images, modalities: { input: m.images ? ["text", "image"] : ["text"], output: ["text"] }, - limit: { context: m.context, output: m.output }, + limit: limits(m.id, m.context, m.output), cost: { input: 0, output: 0, cache_read: 0, cache_write: 0 }, variants: variants(m), }])) @@ -110,7 +136,7 @@ function modelOf(site, provider, m) { headers: {}, options: {}, cost: { input: 0, output: 0, cache: { read: 0, write: 0 } }, - limit: { context: m.context ?? 0, output: m.output ?? 0 }, + limit: limits(m.id, m.context, m.output), capabilities: { temperature: true, reasoning: reasons(m), diff --git a/packages/minimax/models.test.mjs b/packages/minimax/models.test.mjs index 5490ebe..31c7b9a 100644 --- a/packages/minimax/models.test.mjs +++ b/packages/minimax/models.test.mjs @@ -31,7 +31,32 @@ test("the config declares MiniMax Code's four models on the Anthropic API", asyn expect(p.models["MiniMax-M3.1-Flash-Preview"].variants.xhigh).toEqual({ thinking: { type: "adaptive" }, effort: "xhigh" }) expect(p.models["MiniMax-M3"].modalities.input).toEqual(["text", "image"]) expect(p.models["MiniMax-M2.7"].modalities.input).toEqual(["text"]) - expect(p.models["MiniMax-M3"].limit).toEqual({ context: 512000, output: 128000 }) + expect(p.models["MiniMax-M3"].limit).toEqual({ context: 1048576, output: 524288 }) + expect(p.models["MiniMax-M3.1-Flash-Preview"].limit).toEqual({ context: 1048576, output: 524288 }) + expect(p.models["MiniMax-M2.7"].limit).toEqual({ context: 200000, output: 128000 }) +}) + +test("a model whose advertised limits are under the real ones gets the real ones", async () => { + f = fakeMiniMax() + f.route("GET /mavis/api/v1/models", () => json({ + version: "7", ttlSeconds: 300, + providers: [ + { providerId: "minimax", config: { + model_order: ["MiniMax-M3.1-Flash", "MiniMax-M2.7"], + models: { + // what MiniMax Code's own list says today + "MiniMax-M3.1-Flash": { name: "M3.1-Flash", limit: { context: 512000, output: 128000 }, modalities: { input: ["text", "image"] }, reasoning: true, thinking_config: { mode: "forced_on" } }, + "MiniMax-M2.7": { name: "MiniMax-M2.7", limit: { context: 200000, output: 128000 }, modalities: { input: ["text"] }, reasoning: true }, + }, + } }, + ], + })) + const hooks = await MiniMaxCodeAuthPlugin({ client: {} }) + const ms = await hooks.provider.models(await given(hooks), { auth }) + // the endpoint allows 1,048,576 input and 524,288 output tokens for it + expect(ms["MiniMax-M3.1-Flash"].limit).toEqual({ context: 1048576, output: 524288 }) + // a model with no verified limits keeps the ones the list gave + expect(ms["MiniMax-M2.7"].limit).toEqual({ context: 200000, output: 128000 }) }) test("the live list is MiniMax Code's model config", async () => { diff --git a/packages/minimax/package.json b/packages/minimax/package.json index 370e294..74843cf 100644 --- a/packages/minimax/package.json +++ b/packages/minimax/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-minimax-auth", - "version": "0.1.2", + "version": "0.1.3", "description": "OpenCode provider plugins for MiniMax Code accounts: their credits and M Plan, China (minimax-code) and international (minimax-code-global), with MiniMax Code's own device sign-in", "type": "module", "main": "./index.mjs",