modelmix 3.9.4 → 3.9.8

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/MODELS.md CHANGED
@@ -342,4 +342,14 @@ All providers inherit from `MixCustom` base class which provides common function
342
342
  - **Base URL**: `https://api.groq.com/openai/v1/chat/completions`
343
343
  - **Input Format**: Same as OpenAI
344
344
  - **Output Format**: Same as OpenAI
345
- - **Special Notes**: Uses OpenAI-compatible format
345
+ - **Special Notes**: Uses OpenAI-compatible format
346
+
347
+ ### MiniMax (MixMiniMax)
348
+ - **Base URL**: `https://api.minimax.io/v1/chat/completions`
349
+ - **Input Format**: Same as OpenAI
350
+ - **Output Format**: Same as OpenAI
351
+ - **Special Notes**:
352
+ - Uses OpenAI-compatible API interface
353
+ - Requires `MINIMAX_API_KEY` environment variable
354
+ - Inherits all OpenAI functionality including tool calling
355
+ - Available models: `MiniMax-M2`
package/README.md CHANGED
@@ -27,6 +27,7 @@ Only the API keys you plan to use are required.
27
27
  ```plaintext
28
28
  ANTHROPIC_API_KEY="sk-ant-..."
29
29
  OPENAI_API_KEY="sk-proj-..."
30
+ MINIMAX_API_KEY="your-minimax-key..."
30
31
  ...
31
32
  GOOGLE_API_KEY="AIza..."
32
33
  ```
@@ -117,6 +118,7 @@ Here's a comprehensive list of available methods:
117
118
 
118
119
  | Method | Provider | Model | Price (I/O) per 1 M tokens |
119
120
  | ------------------ | ---------- | ------------------------------ | -------------------------- |
121
+ | `gpt51()` | OpenAI | gpt-5.1 | [\$1.25 / \$10.00][1] |
120
122
  | `gpt5()` | OpenAI | gpt-5 | [\$1.25 / \$10.00][1] |
121
123
  | `gpt5mini()` | OpenAI | gpt-5-mini | [\$0.25 / \$2.00][1] |
122
124
  | `gpt5nano()` | OpenAI | gpt-5-nano | [\$0.05 / \$0.40][1] |
@@ -136,6 +138,7 @@ Here's a comprehensive list of available methods:
136
138
  | `grok3()` | Grok | grok-3 | [\$3.00 / \$15.00][6] |
137
139
  | `grok3mini()` | Grok | grok-3-mini | [\$0.30 / \$0.50][6] |
138
140
  | `grok4()` | Grok | grok-4-0709 | [\$3.00 / \$15.00][6] |
141
+ | `minimaxM2()` | MiniMax | MiniMax-M2 | [\$0.30 / \$1.20][9] |
139
142
  | `sonar()` | Perplexity | sonar | [\$1.00 / \$1.00][4] |
140
143
  | `sonarPro()` | Perplexity | sonar-pro | [\$3.00 / \$15.00][4] |
141
144
  | `scout()` | Groq | Llama-4-Scout-17B-16E-Instruct | [\$0.11 / \$0.34][5] |
@@ -153,6 +156,7 @@ Here's a comprehensive list of available methods:
153
156
  [6]: https://docs.x.ai/docs/models "xAI"
154
157
  [7]: https://www.together.ai/pricing "Together AI"
155
158
  [8]: https://lambda.ai/inference "Lambda Pricing"
159
+ [9]: https://www.minimax.io/price "MiniMax Pricing"
156
160
 
157
161
  Each method accepts optional `options` and `config` parameters to customize the model's behavior. For example:
158
162
 
@@ -0,0 +1,22 @@
1
+ import { ModelMix } from '../index.js';
2
+ process.loadEnvFile();
3
+
4
+
5
+
6
+ const main = async () => {
7
+
8
+ const bot = ModelMix
9
+ .new({ config: { debug: true } })
10
+ .minimaxM2()
11
+ .setSystem('You are a helpful assistant.');
12
+
13
+ bot.addText('What is the capital of France?');
14
+
15
+ const all = await bot.raw();
16
+
17
+ console.log('\n=== RESPONSE ===');
18
+ console.log(all);
19
+ }
20
+
21
+ main().catch(console.error);
22
+
package/index.js CHANGED
@@ -100,6 +100,9 @@ class ModelMix {
100
100
  gpt5nano({ options = {}, config = {} } = {}) {
101
101
  return this.attach('gpt-5-nano', new MixOpenAI({ options, config }));
102
102
  }
103
+ gpt51({ options = {}, config = {} } = {}) {
104
+ return this.attach('gpt-5.1', new MixOpenAI({ options, config }));
105
+ }
103
106
  gptOss({ options = {}, config = {}, mix = { together: false, cerebras: false, groq: true } } = {}) {
104
107
  if (mix.together) return this.attach('openai/gpt-oss-120b', new MixTogether({ options, config }));
105
108
  if (mix.cerebras) return this.attach('gpt-oss-120b', new MixCerebras({ options, config }));
@@ -216,6 +219,14 @@ class ModelMix {
216
219
  return this.attach('lmstudio', new MixLMStudio({ options, config }));
217
220
  }
218
221
 
222
+ minimaxM2({ options = {}, config = {} } = {}) {
223
+ return this.attach('MiniMax-M2', new MixMiniMax({ options, config }));
224
+ }
225
+
226
+ minimaxM2Stable({ options = {}, config = {} } = {}) {
227
+ return this.attach('MiniMax-M2-Stable', new MixMiniMax({ options, config }));
228
+ }
229
+
219
230
  addText(text, { role = "user" } = {}) {
220
231
  const content = [{
221
232
  type: "text",
@@ -569,7 +580,7 @@ class ModelMix {
569
580
 
570
581
  const result = await providerInstance.create({ options: currentOptions, config: currentConfig });
571
582
 
572
- if (result.toolCalls.length > 0) {
583
+ if (result.toolCalls && result.toolCalls.length > 0) {
573
584
 
574
585
  if (result.message) {
575
586
  if (result.signature) {
@@ -902,7 +913,12 @@ class MixCustom {
902
913
  }
903
914
  });
904
915
 
905
- response.data.on('end', () => resolve({ response: raw, message: message.trim() }));
916
+ response.data.on('end', () => resolve({
917
+ response: raw,
918
+ message: message.trim(),
919
+ toolCalls: [],
920
+ think: null
921
+ }));
906
922
  response.data.on('error', reject);
907
923
  });
908
924
  }
@@ -1245,6 +1261,29 @@ class MixAnthropic extends MixCustom {
1245
1261
  }
1246
1262
  }
1247
1263
 
1264
+ class MixMiniMax extends MixOpenAI {
1265
+ getDefaultConfig(customConfig) {
1266
+
1267
+ if (!process.env.MINIMAX_API_KEY) {
1268
+ throw new Error('MiniMax API key not found. Please provide it in config or set MINIMAX_API_KEY environment variable.');
1269
+ }
1270
+
1271
+ return MixCustom.prototype.getDefaultConfig.call(this, {
1272
+ url: 'https://api.minimax.io/v1/chat/completions',
1273
+ apiKey: process.env.MINIMAX_API_KEY,
1274
+ ...customConfig
1275
+ });
1276
+ }
1277
+
1278
+ extractDelta(data) {
1279
+ // MiniMax might send different formats during streaming
1280
+ if (data.choices && data.choices[0] && data.choices[0].delta && data.choices[0].delta.content) {
1281
+ return data.choices[0].delta.content;
1282
+ }
1283
+ return '';
1284
+ }
1285
+ }
1286
+
1248
1287
  class MixPerplexity extends MixCustom {
1249
1288
  getDefaultConfig(customConfig) {
1250
1289
 
@@ -1662,4 +1701,4 @@ class MixGoogle extends MixCustom {
1662
1701
  }
1663
1702
  }
1664
1703
 
1665
- module.exports = { MixCustom, ModelMix, MixAnthropic, MixOpenAI, MixPerplexity, MixOllama, MixLMStudio, MixGroq, MixTogether, MixGrok, MixCerebras, MixGoogle };
1704
+ module.exports = { MixCustom, ModelMix, MixAnthropic, MixMiniMax, MixOpenAI, MixPerplexity, MixOllama, MixLMStudio, MixGroq, MixTogether, MixGrok, MixCerebras, MixGoogle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelmix",
3
- "version": "3.9.4",
3
+ "version": "3.9.8",
4
4
  "description": "🧬 ModelMix - Unified API for Diverse AI LLM.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -26,7 +26,7 @@
26
26
  "opus",
27
27
  "sonnet",
28
28
  "multimodal",
29
- "groq",
29
+ "m2",
30
30
  "gemini",
31
31
  "ollama",
32
32
  "lmstudio",
@@ -35,7 +35,7 @@
35
35
  "oss",
36
36
  "k2",
37
37
  "reasoning",
38
- "bottleneck",
38
+ "minimax",
39
39
  "cerebras",
40
40
  "thinking",
41
41
  "clasen"