@eum-agent/llm-provider-minimax 1.1.0 → 1.2.0
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/dist/index.js +331 -67
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
//#endregion
|
|
2
2
|
//#region src/catalog.ts
|
|
3
|
-
/** Supplier-owned catalogue rows; protocol request facts belong to protocol registrations. */
|
|
4
3
|
const catalog = {
|
|
5
4
|
vendors: [{
|
|
6
5
|
kind: "vendor",
|
|
7
6
|
id: "minimax-cn",
|
|
8
7
|
logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EMinimax%3C%2Ftitle%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22lobe-icons-minimax-_R_0_%22%20x1%3D%220%25%22%20x2%3D%22100.182%25%22%20y1%3D%2250.057%25%22%20y2%3D%2250.057%25%22%3E%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23E2167E%22%3E%3C%2Fstop%3E%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23FE603C%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M16.278%202c1.156%200%202.093.927%202.093%202.07v12.501a.74.74%200%2000.744.709.74.74%200%2000.743-.709V9.099a2.06%202.06%200%20012.071-2.049A2.06%202.06%200%200124%209.1v6.561a.649.649%200%2001-.652.645.649.649%200%2001-.653-.645V9.1a.762.762%200%2000-.766-.758.762.762%200%2000-.766.758v7.472a2.037%202.037%200%2001-2.048%202.026%202.037%202.037%200%2001-2.048-2.026v-12.5a.785.785%200%2000-.788-.753.785.785%200%2000-.789.752l-.001%2015.904A2.037%202.037%200%200113.441%2022a2.037%202.037%200%2001-2.048-2.026V18.04c0-.356.292-.645.652-.645.36%200%20.652.289.652.645v1.934c0%20.263.142.506.372.638.23.131.514.131.744%200a.734.734%200%2000.372-.638V4.07c0-1.143.937-2.07%202.093-2.07zm-5.674%200c1.156%200%202.093.927%202.093%202.07v11.523a.648.648%200%2001-.652.645.648.648%200%2001-.652-.645V4.07a.785.785%200%2000-.789-.78.785.785%200%2000-.789.78v14.013a2.06%202.06%200%2001-2.07%202.048%202.06%202.06%200%2001-2.071-2.048V9.1a.762.762%200%2000-.766-.758.762.762%200%2000-.766.758v3.8a2.06%202.06%200%2001-2.071%202.049A2.06%202.06%200%20010%2012.9v-1.378c0-.357.292-.646.652-.646.36%200%20.653.29.653.646V12.9c0%20.418.343.757.766.757s.766-.339.766-.757V9.099a2.06%202.06%200%20012.07-2.048%202.06%202.06%200%20012.071%202.048v8.984c0%20.419.343.758.767.758.423%200%20.766-.339.766-.758V4.07c0-1.143.937-2.07%202.093-2.07z%22%20fill%3D%22url%28%23lobe-icons-minimax-_R_0_%29%22%20fill-rule%3D%22nonzero%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
|
|
9
8
|
name: "MiniMax",
|
|
10
|
-
region: "
|
|
9
|
+
region: "\u56fd\u5185",
|
|
11
10
|
market: "domestic",
|
|
12
11
|
catalogKey: "minimax-cn",
|
|
13
12
|
canListModels: true,
|
|
@@ -28,7 +27,7 @@ const catalog = {
|
|
|
28
27
|
id: "minimax",
|
|
29
28
|
logo: "data:image/svg+xml,%3Csvg%20height%3D%2224%22%20style%3D%22flex%3Anone%3Bline-height%3A1%22%20viewBox%3D%220%200%2024%2024%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EMinimax%3C%2Ftitle%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22lobe-icons-minimax-_R_0_%22%20x1%3D%220%25%22%20x2%3D%22100.182%25%22%20y1%3D%2250.057%25%22%20y2%3D%2250.057%25%22%3E%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23E2167E%22%3E%3C%2Fstop%3E%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23FE603C%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M16.278%202c1.156%200%202.093.927%202.093%202.07v12.501a.74.74%200%2000.744.709.74.74%200%2000.743-.709V9.099a2.06%202.06%200%20012.071-2.049A2.06%202.06%200%200124%209.1v6.561a.649.649%200%2001-.652.645.649.649%200%2001-.653-.645V9.1a.762.762%200%2000-.766-.758.762.762%200%2000-.766.758v7.472a2.037%202.037%200%2001-2.048%202.026%202.037%202.037%200%2001-2.048-2.026v-12.5a.785.785%200%2000-.788-.753.785.785%200%2000-.789.752l-.001%2015.904A2.037%202.037%200%200113.441%2022a2.037%202.037%200%2001-2.048-2.026V18.04c0-.356.292-.645.652-.645.36%200%20.652.289.652.645v1.934c0%20.263.142.506.372.638.23.131.514.131.744%200a.734.734%200%2000.372-.638V4.07c0-1.143.937-2.07%202.093-2.07zm-5.674%200c1.156%200%202.093.927%202.093%202.07v11.523a.648.648%200%2001-.652.645.648.648%200%2001-.652-.645V4.07a.785.785%200%2000-.789-.78.785.785%200%2000-.789.78v14.013a2.06%202.06%200%2001-2.07%202.048%202.06%202.06%200%2001-2.071-2.048V9.1a.762.762%200%2000-.766-.758.762.762%200%2000-.766.758v3.8a2.06%202.06%200%2001-2.071%202.049A2.06%202.06%200%20010%2012.9v-1.378c0-.357.292-.646.652-.646.36%200%20.653.29.653.646V12.9c0%20.418.343.757.766.757s.766-.339.766-.757V9.099a2.06%202.06%200%20012.07-2.048%202.06%202.06%200%20012.071%202.048v8.984c0%20.419.343.758.767.758.423%200%20.766-.339.766-.758V4.07c0-1.143.937-2.07%202.093-2.07z%22%20fill%3D%22url%28%23lobe-icons-minimax-_R_0_%29%22%20fill-rule%3D%22nonzero%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E",
|
|
30
29
|
name: "MiniMax",
|
|
31
|
-
region: "
|
|
30
|
+
region: "\u56fd\u9645",
|
|
32
31
|
market: "international",
|
|
33
32
|
catalogKey: "minimax",
|
|
34
33
|
canListModels: true,
|
|
@@ -85,9 +84,9 @@ const catalog = {
|
|
|
85
84
|
},
|
|
86
85
|
"release_date": "2025-12-23"
|
|
87
86
|
},
|
|
88
|
-
"MiniMax-M2.
|
|
89
|
-
"id": "MiniMax-M2.
|
|
90
|
-
"name": "MiniMax-M2.
|
|
87
|
+
"MiniMax-M2.7-highspeed": {
|
|
88
|
+
"id": "MiniMax-M2.7-highspeed",
|
|
89
|
+
"name": "MiniMax-M2.7-highspeed",
|
|
91
90
|
"family": "minimax",
|
|
92
91
|
"reasoning": true,
|
|
93
92
|
"reasoning_options": [],
|
|
@@ -102,33 +101,46 @@ const catalog = {
|
|
|
102
101
|
"context": 204800,
|
|
103
102
|
"output": 131072
|
|
104
103
|
},
|
|
105
|
-
"release_date": "2026-
|
|
104
|
+
"release_date": "2026-03-18"
|
|
106
105
|
},
|
|
107
|
-
"MiniMax-
|
|
108
|
-
"id": "MiniMax-
|
|
109
|
-
"name": "MiniMax-
|
|
106
|
+
"MiniMax-M3": {
|
|
107
|
+
"id": "MiniMax-M3",
|
|
108
|
+
"name": "MiniMax-M3",
|
|
110
109
|
"family": "minimax",
|
|
111
110
|
"reasoning": true,
|
|
112
|
-
"reasoning_options": [],
|
|
111
|
+
"reasoning_options": [{ "type": "toggle" }],
|
|
113
112
|
"temperature": true,
|
|
114
113
|
"tool_call": true,
|
|
115
|
-
"attachment":
|
|
114
|
+
"attachment": true,
|
|
116
115
|
"modalities": {
|
|
117
|
-
"input": [
|
|
116
|
+
"input": [
|
|
117
|
+
"text",
|
|
118
|
+
"image",
|
|
119
|
+
"video"
|
|
120
|
+
],
|
|
118
121
|
"output": ["text"]
|
|
119
122
|
},
|
|
120
123
|
"limit": {
|
|
121
|
-
"context":
|
|
122
|
-
"output":
|
|
124
|
+
"context": 1e6,
|
|
125
|
+
"output": 524288
|
|
123
126
|
},
|
|
124
|
-
"release_date": "2026-
|
|
127
|
+
"release_date": "2026-06-01"
|
|
125
128
|
},
|
|
126
|
-
"MiniMax-M3": {
|
|
127
|
-
"id": "MiniMax-M3",
|
|
128
|
-
"name": "MiniMax-M3",
|
|
129
|
+
"MiniMax-M3.1-Flash": {
|
|
130
|
+
"id": "MiniMax-M3.1-Flash",
|
|
131
|
+
"name": "MiniMax-M3.1-Flash",
|
|
129
132
|
"family": "minimax",
|
|
130
133
|
"reasoning": true,
|
|
131
|
-
"reasoning_options": [{
|
|
134
|
+
"reasoning_options": [{
|
|
135
|
+
"type": "effort",
|
|
136
|
+
"values": [
|
|
137
|
+
"low",
|
|
138
|
+
"medium",
|
|
139
|
+
"high",
|
|
140
|
+
"xhigh",
|
|
141
|
+
"max"
|
|
142
|
+
]
|
|
143
|
+
}],
|
|
132
144
|
"temperature": true,
|
|
133
145
|
"tool_call": true,
|
|
134
146
|
"attachment": true,
|
|
@@ -141,14 +153,14 @@ const catalog = {
|
|
|
141
153
|
"output": ["text"]
|
|
142
154
|
},
|
|
143
155
|
"limit": {
|
|
144
|
-
"context":
|
|
145
|
-
"output":
|
|
156
|
+
"context": 1e6,
|
|
157
|
+
"output": 524288
|
|
146
158
|
},
|
|
147
|
-
"release_date": "2026-
|
|
159
|
+
"release_date": "2026-10-19"
|
|
148
160
|
},
|
|
149
|
-
"MiniMax-M2.
|
|
150
|
-
"id": "MiniMax-M2.
|
|
151
|
-
"name": "MiniMax-M2.
|
|
161
|
+
"MiniMax-M2.5": {
|
|
162
|
+
"id": "MiniMax-M2.5",
|
|
163
|
+
"name": "MiniMax-M2.5",
|
|
152
164
|
"family": "minimax",
|
|
153
165
|
"reasoning": true,
|
|
154
166
|
"reasoning_options": [],
|
|
@@ -163,7 +175,26 @@ const catalog = {
|
|
|
163
175
|
"context": 204800,
|
|
164
176
|
"output": 131072
|
|
165
177
|
},
|
|
166
|
-
"release_date": "2026-
|
|
178
|
+
"release_date": "2026-02-12"
|
|
179
|
+
},
|
|
180
|
+
"MiniMax-M2.5-highspeed": {
|
|
181
|
+
"id": "MiniMax-M2.5-highspeed",
|
|
182
|
+
"name": "MiniMax-M2.5-highspeed",
|
|
183
|
+
"family": "minimax",
|
|
184
|
+
"reasoning": true,
|
|
185
|
+
"reasoning_options": [],
|
|
186
|
+
"temperature": true,
|
|
187
|
+
"tool_call": true,
|
|
188
|
+
"attachment": false,
|
|
189
|
+
"modalities": {
|
|
190
|
+
"input": ["text"],
|
|
191
|
+
"output": ["text"]
|
|
192
|
+
},
|
|
193
|
+
"limit": {
|
|
194
|
+
"context": 204800,
|
|
195
|
+
"output": 131072
|
|
196
|
+
},
|
|
197
|
+
"release_date": "2026-02-13"
|
|
167
198
|
},
|
|
168
199
|
"MiniMax-M2.7": {
|
|
169
200
|
"id": "MiniMax-M2.7",
|
|
@@ -224,9 +255,9 @@ const catalog = {
|
|
|
224
255
|
},
|
|
225
256
|
"release_date": "2025-12-23"
|
|
226
257
|
},
|
|
227
|
-
"MiniMax-M2.
|
|
228
|
-
"id": "MiniMax-M2.
|
|
229
|
-
"name": "MiniMax-M2.
|
|
258
|
+
"MiniMax-M2.7-highspeed": {
|
|
259
|
+
"id": "MiniMax-M2.7-highspeed",
|
|
260
|
+
"name": "MiniMax-M2.7-highspeed",
|
|
230
261
|
"family": "minimax",
|
|
231
262
|
"reasoning": true,
|
|
232
263
|
"reasoning_options": [],
|
|
@@ -241,33 +272,46 @@ const catalog = {
|
|
|
241
272
|
"context": 204800,
|
|
242
273
|
"output": 131072
|
|
243
274
|
},
|
|
244
|
-
"release_date": "2026-
|
|
275
|
+
"release_date": "2026-03-18"
|
|
245
276
|
},
|
|
246
|
-
"MiniMax-
|
|
247
|
-
"id": "MiniMax-
|
|
248
|
-
"name": "MiniMax-
|
|
277
|
+
"MiniMax-M3": {
|
|
278
|
+
"id": "MiniMax-M3",
|
|
279
|
+
"name": "MiniMax-M3",
|
|
249
280
|
"family": "minimax",
|
|
250
281
|
"reasoning": true,
|
|
251
|
-
"reasoning_options": [],
|
|
282
|
+
"reasoning_options": [{ "type": "toggle" }],
|
|
252
283
|
"temperature": true,
|
|
253
284
|
"tool_call": true,
|
|
254
|
-
"attachment":
|
|
285
|
+
"attachment": true,
|
|
255
286
|
"modalities": {
|
|
256
|
-
"input": [
|
|
287
|
+
"input": [
|
|
288
|
+
"text",
|
|
289
|
+
"image",
|
|
290
|
+
"video"
|
|
291
|
+
],
|
|
257
292
|
"output": ["text"]
|
|
258
293
|
},
|
|
259
294
|
"limit": {
|
|
260
|
-
"context":
|
|
261
|
-
"output":
|
|
295
|
+
"context": 1e6,
|
|
296
|
+
"output": 524288
|
|
262
297
|
},
|
|
263
|
-
"release_date": "2026-
|
|
298
|
+
"release_date": "2026-06-01"
|
|
264
299
|
},
|
|
265
|
-
"MiniMax-M3": {
|
|
266
|
-
"id": "MiniMax-M3",
|
|
267
|
-
"name": "MiniMax-M3",
|
|
300
|
+
"MiniMax-M3.1-Flash": {
|
|
301
|
+
"id": "MiniMax-M3.1-Flash",
|
|
302
|
+
"name": "MiniMax-M3.1-Flash",
|
|
268
303
|
"family": "minimax",
|
|
269
304
|
"reasoning": true,
|
|
270
|
-
"reasoning_options": [{
|
|
305
|
+
"reasoning_options": [{
|
|
306
|
+
"type": "effort",
|
|
307
|
+
"values": [
|
|
308
|
+
"low",
|
|
309
|
+
"medium",
|
|
310
|
+
"high",
|
|
311
|
+
"xhigh",
|
|
312
|
+
"max"
|
|
313
|
+
]
|
|
314
|
+
}],
|
|
271
315
|
"temperature": true,
|
|
272
316
|
"tool_call": true,
|
|
273
317
|
"attachment": true,
|
|
@@ -280,14 +324,14 @@ const catalog = {
|
|
|
280
324
|
"output": ["text"]
|
|
281
325
|
},
|
|
282
326
|
"limit": {
|
|
283
|
-
"context":
|
|
284
|
-
"output":
|
|
327
|
+
"context": 1e6,
|
|
328
|
+
"output": 524288
|
|
285
329
|
},
|
|
286
|
-
"release_date": "2026-
|
|
330
|
+
"release_date": "2026-10-19"
|
|
287
331
|
},
|
|
288
|
-
"MiniMax-M2.
|
|
289
|
-
"id": "MiniMax-M2.
|
|
290
|
-
"name": "MiniMax-M2.
|
|
332
|
+
"MiniMax-M2.5": {
|
|
333
|
+
"id": "MiniMax-M2.5",
|
|
334
|
+
"name": "MiniMax-M2.5",
|
|
291
335
|
"family": "minimax",
|
|
292
336
|
"reasoning": true,
|
|
293
337
|
"reasoning_options": [],
|
|
@@ -302,7 +346,26 @@ const catalog = {
|
|
|
302
346
|
"context": 204800,
|
|
303
347
|
"output": 131072
|
|
304
348
|
},
|
|
305
|
-
"release_date": "2026-
|
|
349
|
+
"release_date": "2026-02-12"
|
|
350
|
+
},
|
|
351
|
+
"MiniMax-M2.5-highspeed": {
|
|
352
|
+
"id": "MiniMax-M2.5-highspeed",
|
|
353
|
+
"name": "MiniMax-M2.5-highspeed",
|
|
354
|
+
"family": "minimax",
|
|
355
|
+
"reasoning": true,
|
|
356
|
+
"reasoning_options": [],
|
|
357
|
+
"temperature": true,
|
|
358
|
+
"tool_call": true,
|
|
359
|
+
"attachment": false,
|
|
360
|
+
"modalities": {
|
|
361
|
+
"input": ["text"],
|
|
362
|
+
"output": ["text"]
|
|
363
|
+
},
|
|
364
|
+
"limit": {
|
|
365
|
+
"context": 204800,
|
|
366
|
+
"output": 131072
|
|
367
|
+
},
|
|
368
|
+
"release_date": "2026-02-13"
|
|
306
369
|
},
|
|
307
370
|
"MiniMax-M2.7": {
|
|
308
371
|
"id": "MiniMax-M2.7",
|
|
@@ -325,11 +388,219 @@ const catalog = {
|
|
|
325
388
|
}
|
|
326
389
|
}
|
|
327
390
|
},
|
|
328
|
-
snapshotAt: Date.parse("2026-
|
|
391
|
+
snapshotAt: Date.parse("2026-11-18")
|
|
329
392
|
};
|
|
330
393
|
//#endregion
|
|
394
|
+
//#region src/facts.ts
|
|
395
|
+
const outputLimit = {
|
|
396
|
+
ordinary: 16384,
|
|
397
|
+
thinking: 32768
|
|
398
|
+
};
|
|
399
|
+
const modelFacts = {
|
|
400
|
+
revisions: ["MiniMax-M3", "MiniMax-M3.1-Flash"].map((model) => ({
|
|
401
|
+
protocolId: "openai-responses",
|
|
402
|
+
model,
|
|
403
|
+
field: "limit.output",
|
|
404
|
+
value: { unknown: true },
|
|
405
|
+
corrects: { structural: "MiniMax Responses declares no output maximum; models.dev keeps one per model" },
|
|
406
|
+
source: "https://platform.minimax.io/docs/api-reference/responses-create",
|
|
407
|
+
verifiedAt: "2026-10-29"
|
|
408
|
+
})),
|
|
409
|
+
presets: ["MiniMax-M3", "MiniMax-M3.1-Flash"].map((model) => ({
|
|
410
|
+
model,
|
|
411
|
+
entry: { outputLimit }
|
|
412
|
+
}))
|
|
413
|
+
};
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/resources.ts
|
|
416
|
+
function failure(detail) {
|
|
417
|
+
const code = detail === "Resource request failed" ? "source-failed" : "invalid-response";
|
|
418
|
+
return Object.assign(new Error(code), {
|
|
419
|
+
name: "ProviderResourceFailure",
|
|
420
|
+
code,
|
|
421
|
+
retryable: false
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
const labels = (en, zh) => ({
|
|
425
|
+
"en-US": en,
|
|
426
|
+
"zh-CN": zh
|
|
427
|
+
});
|
|
428
|
+
function object(value) {
|
|
429
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw failure("Invalid resource response");
|
|
430
|
+
return value;
|
|
431
|
+
}
|
|
432
|
+
function balance(body, domestic) {
|
|
433
|
+
if (!("available_amount" in body)) throw failure("Invalid resource response");
|
|
434
|
+
const resources = [];
|
|
435
|
+
for (const [field, id, en, zh] of [
|
|
436
|
+
[
|
|
437
|
+
"available_amount",
|
|
438
|
+
"available-balance",
|
|
439
|
+
"Available balance",
|
|
440
|
+
"\u53ef\u7528\u4f59\u989d"
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
"cash_balance",
|
|
444
|
+
"cash-balance",
|
|
445
|
+
"Cash balance",
|
|
446
|
+
"\u73b0\u91d1\u4f59\u989d"
|
|
447
|
+
],
|
|
448
|
+
[
|
|
449
|
+
"voucher_balance",
|
|
450
|
+
"voucher-balance",
|
|
451
|
+
"Voucher balance",
|
|
452
|
+
"\u4ee3\u91d1\u5238\u4f59\u989d"
|
|
453
|
+
]
|
|
454
|
+
]) {
|
|
455
|
+
const value = body[field];
|
|
456
|
+
if (value === void 0) continue;
|
|
457
|
+
if (typeof value !== "string" || !/^-?(0|[1-9]\d*)(\.\d+)?$/.test(value)) throw failure("Invalid resource amount");
|
|
458
|
+
resources.push({
|
|
459
|
+
kind: "balance",
|
|
460
|
+
id,
|
|
461
|
+
group: id === "available-balance" ? "available-balance" : "balance-components",
|
|
462
|
+
labels: labels(en, zh),
|
|
463
|
+
valueOrigin: "reported",
|
|
464
|
+
meaning: value.startsWith("-") || /^0(?:\.0+)?$/.test(value) ? "exhausted" : "available",
|
|
465
|
+
remaining: {
|
|
466
|
+
value: value.includes(".") ? value.replace(/0+$/, "").replace(/\.$/, "").replace(/^-0$/, "0") : value.replace(/^-0$/, "0"),
|
|
467
|
+
unit: domestic ? {
|
|
468
|
+
kind: "currency",
|
|
469
|
+
code: "CNY"
|
|
470
|
+
} : {
|
|
471
|
+
kind: "unknown",
|
|
472
|
+
label: "Unverified account balance unit"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
...id !== "available-balance" ? { relationships: [{
|
|
476
|
+
kind: "part-of",
|
|
477
|
+
resourceId: "available-balance"
|
|
478
|
+
}] } : {}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
return {
|
|
482
|
+
kind: "ready",
|
|
483
|
+
resources
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
function resourceCapability(domestic) {
|
|
487
|
+
const origin = domestic ? "https://api.minimaxi.com" : "https://api.minimax.io";
|
|
488
|
+
const origins = domestic ? [origin, "https://api.minimax.cn"] : [origin];
|
|
489
|
+
return {
|
|
490
|
+
support: "supported",
|
|
491
|
+
applicability: {
|
|
492
|
+
kind: "base-url",
|
|
493
|
+
defaultBaseUrl: `${origin}/anthropic/v1`,
|
|
494
|
+
allowedBaseUrls: origins.flatMap((one) => [`${one}/anthropic/v1`, `${one}/v1`])
|
|
495
|
+
},
|
|
496
|
+
sources: [{
|
|
497
|
+
id: "account",
|
|
498
|
+
labels: labels("Account resources", "\u8d26\u6237\u8d44\u6e90"),
|
|
499
|
+
optional: false,
|
|
500
|
+
allowedHeaderNames: ["Authorization"],
|
|
501
|
+
requests: [{
|
|
502
|
+
id: "quota",
|
|
503
|
+
method: "GET",
|
|
504
|
+
url: `${origin}/v1/token_plan/remains`
|
|
505
|
+
}, {
|
|
506
|
+
id: "balance",
|
|
507
|
+
method: "GET",
|
|
508
|
+
url: `${domestic ? "https://api.minimax.cn" : origin}/account/query_balance`
|
|
509
|
+
}]
|
|
510
|
+
}],
|
|
511
|
+
presets: [{
|
|
512
|
+
id: "subscription",
|
|
513
|
+
labels: labels("Subscription", "\u8ba2\u9605\u989d\u5ea6"),
|
|
514
|
+
sourceId: "account",
|
|
515
|
+
order: 0,
|
|
516
|
+
recommended: true,
|
|
517
|
+
format: "quota-windows",
|
|
518
|
+
match: { group: "subscription-windows" }
|
|
519
|
+
}, {
|
|
520
|
+
id: "available-balance",
|
|
521
|
+
labels: labels("Available balance", "\u53ef\u7528\u4f59\u989d"),
|
|
522
|
+
sourceId: "account",
|
|
523
|
+
order: 1,
|
|
524
|
+
recommended: true,
|
|
525
|
+
format: "amount",
|
|
526
|
+
match: { resourceIds: ["available-balance"] }
|
|
527
|
+
}]
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
async function readResourceSource(input) {
|
|
531
|
+
if (input.sourceId !== "account" || !["minimax-cn", "minimax"].includes(input.endpointId)) throw failure("Invalid resource source");
|
|
532
|
+
const key = input.secrets.apiKey;
|
|
533
|
+
if (!key) return {
|
|
534
|
+
kind: "unavailable",
|
|
535
|
+
reason: "auth-required"
|
|
536
|
+
};
|
|
537
|
+
const requestId = key.startsWith("sk-api-") ? "balance" : "quota";
|
|
538
|
+
const response = await input.queryJSON({
|
|
539
|
+
requestId,
|
|
540
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
541
|
+
});
|
|
542
|
+
if (response.status === 401) return {
|
|
543
|
+
kind: "unavailable",
|
|
544
|
+
reason: "auth-required"
|
|
545
|
+
};
|
|
546
|
+
if (response.status === 403) return {
|
|
547
|
+
kind: "unavailable",
|
|
548
|
+
reason: "permission-denied"
|
|
549
|
+
};
|
|
550
|
+
if (response.status !== 200) throw failure("Resource request failed");
|
|
551
|
+
const body = object(response.body);
|
|
552
|
+
if (body.base_resp !== void 0 && object(body.base_resp).status_code !== 0) throw failure("Resource request failed");
|
|
553
|
+
if (requestId === "balance") return balance(body, input.endpointId === "minimax-cn");
|
|
554
|
+
if (!Array.isArray(body.model_remains)) throw failure("Invalid resource response");
|
|
555
|
+
const resources = [];
|
|
556
|
+
for (const raw of body.model_remains) {
|
|
557
|
+
const row = object(raw);
|
|
558
|
+
const name = row.model_name;
|
|
559
|
+
if (typeof name !== "string" || !/^[a-zA-Z0-9_-]{1,80}$/.test(name)) throw failure("Invalid resource scope");
|
|
560
|
+
for (const period of ["interval", "weekly"]) {
|
|
561
|
+
let percent = row[`current_${period}_remaining_percent`];
|
|
562
|
+
const boost = period === "weekly" ? row.weekly_boost_permille : void 0;
|
|
563
|
+
if (boost !== void 0 && (typeof boost !== "number" || !Number.isSafeInteger(boost) || boost <= 0)) throw failure("Invalid resource boost");
|
|
564
|
+
if (typeof percent === "number" && typeof boost === "number") percent = percent * boost / 1e3;
|
|
565
|
+
const status = row[`current_${period}_status`];
|
|
566
|
+
if (percent === void 0 && status === void 0) continue;
|
|
567
|
+
if (percent !== void 0 && (typeof percent !== "number" || !Number.isFinite(percent) || percent < 0)) throw failure("Invalid resource percentage");
|
|
568
|
+
const start = row[period === "interval" ? "start_time" : "weekly_start_time"];
|
|
569
|
+
const end = row[period === "interval" ? "end_time" : "weekly_end_time"];
|
|
570
|
+
const duration = typeof start === "number" && typeof end === "number" ? (end - start) / 1e3 : void 0;
|
|
571
|
+
const fixed = typeof end === "number" && Number.isFinite(end) && (period === "weekly" || typeof percent === "number" && percent < 100);
|
|
572
|
+
resources.push({
|
|
573
|
+
kind: "quota",
|
|
574
|
+
id: `${name}-${period}`,
|
|
575
|
+
group: "subscription-windows",
|
|
576
|
+
labels: name === "video" ? labels("Video quota", "\u89c6\u9891\u989d\u5ea6") : labels("Subscription quota", "\u8ba2\u9605\u989d\u5ea6"),
|
|
577
|
+
...name === "general" ? {} : { scope: { models: [name] } },
|
|
578
|
+
valueOrigin: boost === void 0 ? "reported" : "derived",
|
|
579
|
+
meaning: status === 3 ? "unlimited" : status === 2 || percent === 0 ? "exhausted" : percent === void 0 ? "unknown" : "available",
|
|
580
|
+
window: {
|
|
581
|
+
...duration !== void 0 && Number.isSafeInteger(duration) && duration > 0 ? { durationSeconds: duration } : {},
|
|
582
|
+
reset: fixed ? {
|
|
583
|
+
kind: "fixed",
|
|
584
|
+
at: new Date(end).toISOString()
|
|
585
|
+
} : period === "interval" && percent === 100 ? { kind: "rolling" } : { kind: "unknown" }
|
|
586
|
+
},
|
|
587
|
+
...typeof percent === "number" ? {
|
|
588
|
+
remainingPercent: percent,
|
|
589
|
+
...percent > 100 ? { percentBasis: {
|
|
590
|
+
kind: "expanded",
|
|
591
|
+
note: labels("Reported expanded subscription limit", "\u4e0a\u6e38\u6269\u5bb9\u8ba2\u9605\u57fa\u51c6")
|
|
592
|
+
} } : {}
|
|
593
|
+
} : {}
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return {
|
|
598
|
+
kind: "ready",
|
|
599
|
+
resources
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
//#endregion
|
|
331
603
|
//#region src/routing.ts
|
|
332
|
-
/** Maps only declared official roots; protocol implementations own the remaining resource URI. */
|
|
333
604
|
function connectionConfig(endpoint, protocolId, config, aliases = []) {
|
|
334
605
|
const defaults = Object.values(endpoint.capabilities).find((one) => one.protocolIds.includes(protocolId))?.protocolDefaults?.[protocolId] ?? {};
|
|
335
606
|
const configured = config.baseUrl;
|
|
@@ -349,11 +620,11 @@ function connectionConfig(endpoint, protocolId, config, aliases = []) {
|
|
|
349
620
|
}
|
|
350
621
|
//#endregion
|
|
351
622
|
//#region src/type.ts
|
|
352
|
-
/** Stable supplier registration identity. */
|
|
353
623
|
const TYPE = "minimax";
|
|
354
624
|
const endpoints = [{
|
|
355
625
|
id: "minimax-cn",
|
|
356
|
-
|
|
626
|
+
resourceCapability: resourceCapability(true),
|
|
627
|
+
label: "MiniMax \u00b7 \u56fd\u5185",
|
|
357
628
|
capabilities: { chat: {
|
|
358
629
|
protocolIds: [
|
|
359
630
|
"anthropic",
|
|
@@ -374,7 +645,8 @@ const endpoints = [{
|
|
|
374
645
|
credentialGroup: "minimax"
|
|
375
646
|
}, {
|
|
376
647
|
id: "minimax",
|
|
377
|
-
|
|
648
|
+
resourceCapability: resourceCapability(false),
|
|
649
|
+
label: "MiniMax \u00b7 \u56fd\u9645",
|
|
378
650
|
capabilities: { chat: {
|
|
379
651
|
protocolIds: [
|
|
380
652
|
"anthropic",
|
|
@@ -413,10 +685,11 @@ const protocolOptions = {
|
|
|
413
685
|
},
|
|
414
686
|
openai: { reasoningReplay: "reasoning-content" }
|
|
415
687
|
};
|
|
416
|
-
/** Builds this supplier's declaration without network activity or protocol imports. */
|
|
417
688
|
function minimaxProviderType(support) {
|
|
418
689
|
return {
|
|
419
690
|
type: TYPE,
|
|
691
|
+
listingContractVersion: "capacity-listing-v1",
|
|
692
|
+
modelFacts,
|
|
420
693
|
label: "MiniMax",
|
|
421
694
|
fields: [{
|
|
422
695
|
key: "apiKey",
|
|
@@ -425,19 +698,11 @@ function minimaxProviderType(support) {
|
|
|
425
698
|
required: true
|
|
426
699
|
}],
|
|
427
700
|
endpoints,
|
|
701
|
+
readResourceSource,
|
|
428
702
|
catalog: support ? {
|
|
429
703
|
...catalog,
|
|
430
704
|
source: support.catalogueSource("https://models.dev/api.json", "models")
|
|
431
705
|
} : catalog,
|
|
432
|
-
describeModel({ model }) {
|
|
433
|
-
return Object.values(catalog.snapshot).some((row) => Object.hasOwn(row, model)) ? {
|
|
434
|
-
id: model,
|
|
435
|
-
outputLimit: {
|
|
436
|
-
ordinary: 16384,
|
|
437
|
-
thinking: 32768
|
|
438
|
-
}
|
|
439
|
-
} : void 0;
|
|
440
|
-
},
|
|
441
706
|
prepareConnection(input) {
|
|
442
707
|
const endpoint = endpoints.find((one) => one.id === input.endpointId);
|
|
443
708
|
if (!endpoint || !Object.values(endpoint.capabilities).some((one) => one.protocolIds.includes(input.protocolId))) throw new Error("unsupported supplier endpoint or protocol");
|
|
@@ -450,7 +715,6 @@ function minimaxProviderType(support) {
|
|
|
450
715
|
}
|
|
451
716
|
//#endregion
|
|
452
717
|
//#region src/index.ts
|
|
453
|
-
/** Suppliers contribute no tools. */
|
|
454
718
|
const TOOL_NAMES = [];
|
|
455
719
|
const plugin = {
|
|
456
720
|
name: "@eum-agent/llm-provider-minimax",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "MiniMax Model Connection",
|
|
5
5
|
"zh-CN": "模型接入 · MiniMax"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.2.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "MiniMax model provider using the registered Anthropic protocol",
|
|
10
10
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"assets"
|
|
19
19
|
],
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@eum-agent/plugin": "1.
|
|
21
|
+
"@eum-agent/plugin": "1.2.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"zod": "^4.4.3"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"zh-CN": "通过已注册的 Anthropic 协议接入 MiniMax 模型"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eum-agent/llm-management": "1.
|
|
32
|
+
"@eum-agent/llm-management": "1.2.0"
|
|
33
33
|
},
|
|
34
34
|
"kind": "extension"
|
|
35
35
|
},
|