@molecule/api-ai-minimax 1.1.4 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,17 +3,17 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T00:29:38.943Z
6
+ Generated: 2026-10-16T23:28:28.746Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-ai-minimax
10
10
 
11
+ MiniMax AI provider for molecule.dev.
12
+
11
13
  > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
14
  > It is written to be read by coding agents as much as by people, and is generated from this
13
15
  > package's source — edit `src/index.ts` JSDoc, not this file.
14
16
 
15
- MiniMax AI provider for molecule.dev.
16
-
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,UAAU,EAQX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAmtB/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,UAAU,CAEjE"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,UAAU,EAQX,MAAM,kBAAkB,CAAA;AASzB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAmvB/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,UAAU,CAEjE"}
package/dist/provider.js CHANGED
@@ -17,6 +17,8 @@ import './secrets.js';
17
17
  * Whether a model id is a MiniMax M3-family model. Only M3 accepts the
18
18
  * `thinking: {type: "adaptive" | "disabled"}` control — M2.x thinking is
19
19
  * always on and cannot be configured, and sending the param there is invalid.
20
+ * M3.1-Flash is also M3-family for multimodal gating, but see
21
+ * {@link isM31FlashFamily}: it REJECTS `disabled`.
20
22
  *
21
23
  * @param model - The model id (catalog `minimax-m3` or native `MiniMax-M3`).
22
24
  * @returns `true` for M3-family model ids.
@@ -24,6 +26,24 @@ import './secrets.js';
24
26
  function isM3Family(model) {
25
27
  return /^minimax-m3/i.test(model);
26
28
  }
29
+ /**
30
+ * Whether a model id is a MiniMax M3.1-Flash-family model. M3.1-Flash ALWAYS
31
+ * thinks: `thinking: {type: "disabled"}` is answered with a 400 ("requires
32
+ * adaptive thinking") and `reasoning_effort: "none"` is rejected too. Depth is
33
+ * tuned with `reasoning_effort` (`low|medium|high|xhigh|max`, API default
34
+ * `max`) — the only model family on this endpoint where that field does
35
+ * anything (others ignore it).
36
+ *
37
+ * Verified 2026-10-19 on platform.minimax.io (text-chat-openai reference +
38
+ * text-generation guide).
39
+ *
40
+ * @param model - The model id (catalog `minimax-m3.1-flash` or native
41
+ * `MiniMax-M3.1-Flash`).
42
+ * @returns `true` for M3.1-Flash-family model ids.
43
+ */
44
+ function isM31FlashFamily(model) {
45
+ return /^minimax-m3\.1/i.test(model);
46
+ }
27
47
  /**
28
48
  * MiniMax AI provider that implements the `AIProvider` interface
29
49
  * using MiniMax's OpenAI-compatible Chat Completions API with support
@@ -107,7 +127,7 @@ class MiniMaxAIProvider {
107
127
  body.tool_choice = { type: 'function', function: { name: params.toolChoice.name } };
108
128
  }
109
129
  }
110
- // MiniMax's native API has no reasoning_effort / thinking budget. M3 takes
130
+ // MiniMax's native API has no thinking budget. M3 takes
111
131
  // `thinking: {type: "adaptive" | "disabled"}` (the OpenAI-compatible
112
132
  // endpoint defaults to adaptive when omitted); M2.x thinking is always on
113
133
  // and takes no param. Synthase runs M3 as a non-thinking executor (like
@@ -116,13 +136,25 @@ class MiniMaxAIProvider {
116
136
  // re-hosts (`MiniMaxAI/MiniMax-M3`), which the `minimax-m3` anchor never
117
137
  // matches — that omission left thinking defaulted ON for every US turn.
118
138
  if (isM3Family(canonicalModel)) {
119
- body.thinking = { type: params.thinking ? 'adaptive' : 'disabled' };
120
- if (!params.thinking) {
121
- // Open-weights re-hosts (DeepInfra) IGNORE the native `thinking` param
122
- // and default reasoning ON — only `chat_template_kwargs.enable_thinking`
123
- // reaches the template there. The native host accepts both together
124
- // (verified live 2026-08-28), so send both and each host honors its own.
125
- body.chat_template_kwargs = { enable_thinking: false };
139
+ if (isM31FlashFamily(canonicalModel)) {
140
+ // M3.1-Flash ALWAYS thinks — `disabled` is a 400, so never send it
141
+ // (not even for tool-less calls that omit the thinking block). Depth
142
+ // via reasoning_effort when the caller resolved a level; omitted, the
143
+ // upstream default is `max`.
144
+ body.thinking = { type: 'adaptive' };
145
+ if (params.thinking?.effort) {
146
+ body.reasoning_effort = params.thinking.effort;
147
+ }
148
+ }
149
+ else {
150
+ body.thinking = { type: params.thinking ? 'adaptive' : 'disabled' };
151
+ if (!params.thinking) {
152
+ // Open-weights re-hosts (DeepInfra) IGNORE the native `thinking` param
153
+ // and default reasoning ON — only `chat_template_kwargs.enable_thinking`
154
+ // reaches the template there. The native host accepts both together
155
+ // (verified live 2026-08-28), so send both and each host honors its own.
156
+ body.chat_template_kwargs = { enable_thinking: false };
157
+ }
126
158
  }
127
159
  }
128
160
  // Keep thinking out of the visible message: with reasoning_split, thinking
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-ai-minimax",
3
- "version": "1.1.4",
3
+ "version": "1.2.1",
4
4
  "description": "MiniMax AI provider for molecule.dev",
5
5
  "homepage": "https://www.molecule.dev/packages/api-ai-minimax",
6
6
  "type": "module",
@@ -33,11 +33,11 @@
33
33
  "directory": "packages/api/bonds/ai/minimax"
34
34
  },
35
35
  "devDependencies": {
36
- "@molecule/api-ai": "1.3.3",
37
- "@molecule/api-bond": "1.0.2",
38
- "@types/node": "26.1.2",
36
+ "@molecule/api-ai": "1.3.5",
37
+ "@molecule/api-bond": "1.0.3",
38
+ "@types/node": "26.6.5",
39
39
  "typescript": "6.0.3",
40
- "vitest": "4.1.11"
40
+ "vitest": "4.1.12"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@molecule/api-ai": "^1.0.1",