modelmix 4.5.10 → 4.5.14

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
@@ -33,6 +33,7 @@ ANTHROPIC_API_KEY="sk-ant-..."
33
33
  OPENAI_API_KEY="sk-proj-..."
34
34
  OPENROUTER_API_KEY="sk-or-..."
35
35
  MINIMAX_API_KEY="your-minimax-key..."
36
+ NVIDIA_API_KEY="nvapi-..."
36
37
  ...
37
38
  GEMINI_API_KEY="AIza..."
38
39
  ```
@@ -158,15 +159,15 @@ Here's a comprehensive list of available methods:
158
159
  | `gemini31flashLite()`| Google | gemini-3.1-flash-lite-preview | [\$0.25 / \$1.50][3] |
159
160
  | `grok4()` | Grok | grok-4-0709 | [\$3.00 / \$15.00][6] |
160
161
  | `grok41[think]()` | Grok | grok-4-1-fast | [\$0.20 / \$0.50][6] |
161
- | `deepseekV32()` | Fireworks | fireworks/models/deepseek-v3p2| [\$0.56 / \$1.68][10] |
162
- | `GLM47()` | Fireworks | fireworks/models/glm-4p7 | [\$0.55 / \$2.19][10] |
162
+ | `deepseekV4Pro()` | Fireworks | models/deepseek-v4-pro | [\$1.74 / \$3.48][10] |
163
+ | `GLM51()` | Fireworks | models/glm-5p1 | [\$1.05 / \$3.50][10] |
163
164
  | `minimaxM27()` | MiniMax | MiniMax-M2.7 | [\$0.30 / \$1.20][9] |
164
165
  | `sonar()` | Perplexity | sonar | [\$1.00 / \$1.00][4] |
165
166
  | `sonarPro()` | Perplexity | sonar-pro | [\$3.00 / \$15.00][4] |
166
167
  | `hermes3()` | Lambda | Hermes-3-Llama-3.1-405B-FP8 | [\$0.80 / \$0.80][8] |
167
168
  | `qwen3()` | Together | Qwen3-235B-A22B-fp8-tput | [\$0.20 / \$0.60][7] |
168
169
  | `kimiK25think()` | Together | Kimi-K2.5 | [\$0.50 / \$2.80][7] |
169
- | `kimiK26think()` | Fireworks | fireworks/models/kimi-k2p6 | [\$0.95 / \$4.00][10] |
170
+ | `kimiK26think()` | Fireworks | models/kimi-k2p6 | [\$0.95 / \$4.00][10] |
170
171
 
171
172
  [1]: https://platform.openai.com/docs/pricing "Pricing | OpenAI"
172
173
  [2]: https://docs.anthropic.com/en/docs/about-claude/pricing "Pricing - Anthropic"
@@ -179,7 +180,8 @@ Here's a comprehensive list of available methods:
179
180
  [9]: https://platform.minimax.io/docs/api-reference/anthropic-api-compatible-cache#supported-models-and-pricing "MiniMax Pricing"
180
181
  [10]: https://fireworks.ai/pricing#serverless-pricing "Fireworks Pricing"
181
182
 
182
- Each method accepts optional `options` and `config` parameters to customize the model's behavior. For example:
183
+ Each method accepts optional `options`, `config`, and (for multi-provider methods) `mix` parameters to customize behavior.
184
+ For NVIDIA on DeepSeek V4 Pro, use `deepseekV4Pro({ mix: { nvidia: true, fireworks: false } })`.
183
185
 
184
186
  ```javascript
185
187
  const result = await ModelMix.new({
package/demo/nvidia.js ADDED
@@ -0,0 +1,15 @@
1
+ import { ModelMix } from '../index.js';
2
+ try { process.loadEnvFile(); } catch { }
3
+
4
+ const model = ModelMix.new()
5
+ .deepseekV4Flash()
6
+ .addText("Create exactly 5 characters for a narrative game.")
7
+
8
+ const jsonResult = await model.json([], [{
9
+ name: "character name",
10
+ role: "role in the story",
11
+ trait: "main trait",
12
+ goal: "short character goal"
13
+ }]);
14
+
15
+ console.log(jsonResult);
package/index.js CHANGED
@@ -78,8 +78,11 @@ const MODEL_PRICING = {
78
78
  'grok-4-1-fast-non-reasoning': [0.20, 0.50],
79
79
  // Fireworks
80
80
  'accounts/fireworks/models/deepseek-v3p2': [0.56, 1.68],
81
+ 'accounts/fireworks/models/deepseek-v4-pro': [1.74, 3.48],
81
82
  'accounts/fireworks/models/glm-4p7': [0.55, 2.19],
83
+ 'accounts/fireworks/models/glm-5p1': [1.05, 3.50],
82
84
  'accounts/fireworks/models/kimi-k2p5': [0.50, 2.80],
85
+ 'accounts/fireworks/models/qwen3p6-plus': [0.50, 3.00],
83
86
  'fireworks/glm-5': [1.00, 3.20],
84
87
  // MiniMax
85
88
  'MiniMax-M2.1': [0.30, 1.20],
@@ -440,6 +443,10 @@ class ModelMix {
440
443
  return this;
441
444
  }
442
445
 
446
+ qwen36plus({ options = {}, config = {}, mix = { } } = {}) {
447
+ return this.attach('accounts/fireworks/models/qwen3p6-plus', new MixFireworks({ options, config }));
448
+ }
449
+
443
450
  scout({ options = {}, config = {}, mix = {} } = {}) {
444
451
  mix = { ...this.mix, ...mix };
445
452
  if (mix.groq) this.attach('meta-llama/llama-4-scout-17b-16e-instruct', new MixGroq({ options, config }));
@@ -474,6 +481,7 @@ class ModelMix {
474
481
  mix = { ...this.mix, ...mix };
475
482
  if (mix.fireworks) this.attach('accounts/fireworks/models/kimi-k2p6', new MixFireworks({ options, config }));
476
483
  if (mix.openrouter) this.attach('moonshotai/kimi-k2.6', new MixOpenRouter({ options, config }));
484
+ if (mix.together) this.attach('moonshotai/Kimi-K2.6', new MixTogether({ options, config }));
477
485
  return this;
478
486
  }
479
487
 
@@ -512,41 +520,49 @@ class ModelMix {
512
520
  }
513
521
 
514
522
  minimaxM27({ options = {}, config = {}, mix = { openrouter: true, minimax: true } } = {}) {
523
+ mix = { ...this.mix, ...mix };
524
+ if (mix.nvidia) this.attach('minimaxai/minimax-m2.7', new MixNVIDIA({ options, config }));
515
525
  if (mix.openrouter) return this.attach('minimax/minimax-m2.7', new MixOpenRouter({ options, config }));
516
526
  if (mix.minimax) return this.attach('MiniMax-M2.7', new MixMiniMax({ options, config }));
527
+ if (mix.together) return this.attach('MiniMaxAI/MiniMax-M2.7', new MixTogether({ options, config }));
517
528
  return this;
518
529
  }
519
530
 
520
- deepseekV32({ options = {}, config = {}, mix = {} } = {}) {
531
+ deepseekV4Pro({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
521
532
  mix = { ...this.mix, ...mix };
522
- if (mix.fireworks) this.attach('accounts/fireworks/models/deepseek-v3p2', new MixFireworks({ options, config }));
523
- if (mix.openrouter) this.attach('deepseek/deepseek-v3.2', new MixOpenRouter({ options, config }));
533
+ if (mix.nvidia) this.attach('deepseek-ai/deepseek-v4-pro', new MixNVIDIA({ options, config }));
534
+ if (mix.fireworks) this.attach('accounts/fireworks/models/deepseek-v4-pro', new MixFireworks({ options, config }));
535
+ if (mix.openrouter) this.attach('deepseek/deepseek-v4-pro', new MixOpenRouter({ options, config }));
536
+ if (mix.together) this.attach('deepseek-ai/DeepSeek-V4-Pro', new MixTogether({ options, config }));
524
537
  return this;
525
538
  }
526
539
 
527
- GLM5({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
540
+ deepseekV4Flash({ options = {}, config = {}, mix = { nvidia: true } } = {}) {
528
541
  mix = { ...this.mix, ...mix };
529
- if (mix.fireworks) this.attach('fireworks/glm-5', new MixFireworks({ options, config }));
542
+ if (mix.nvidia) this.attach('deepseek-ai/deepseek-v4-flash', new MixNVIDIA({ options, config }));
530
543
  return this;
531
- }
544
+ }
532
545
 
533
- GLM47({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
546
+ GLM51({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
534
547
  mix = { ...this.mix, ...mix };
535
- if (mix.fireworks) this.attach('accounts/fireworks/models/glm-4p7', new MixFireworks({ options, config }));
536
- if (mix.openrouter) this.attach('z-ai/glm-4.7', new MixOpenRouter({ options, config }));
537
- if (mix.cerebras) this.attach('zai-glm-4.7', new MixCerebras({ options, config }));
548
+ if (mix.nvidia) this.attach('z-ai/glm-5.1', new MixNVIDIA({ options, config }));
549
+ if (mix.fireworks) this.attach('accounts/fireworks/models/glm-5p1', new MixFireworks({ options, config }));
550
+ if (mix.openrouter) this.attach('z-ai/glm-5.1', new MixOpenRouter({ options, config }));
551
+ if (mix.together) this.attach('zai-org/GLM-5.1', new MixTogether({ options, config }));
538
552
  return this;
539
553
  }
540
554
 
541
- GLM46({ options = {}, config = {}, mix = { cerebras: true } } = {}) {
555
+ GLM5({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
542
556
  mix = { ...this.mix, ...mix };
543
- if (mix.cerebras) this.attach('zai-glm-4.6', new MixCerebras({ options, config }));
557
+ if (mix.fireworks) this.attach('fireworks/glm-5', new MixFireworks({ options, config }));
544
558
  return this;
545
559
  }
546
560
 
547
- GLM45({ options = {}, config = {}, mix = { openrouter: true } } = {}) {
561
+ GLM47({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
548
562
  mix = { ...this.mix, ...mix };
549
- if (mix.openrouter) this.attach('z-ai/glm-4.5-air:free', new MixOpenRouter({ options, config }));
563
+ if (mix.fireworks) this.attach('accounts/fireworks/models/glm-4p7', new MixFireworks({ options, config }));
564
+ if (mix.openrouter) this.attach('z-ai/glm-4.7', new MixOpenRouter({ options, config }));
565
+ if (mix.cerebras) this.attach('zai-glm-4.7', new MixCerebras({ options, config }));
550
566
  return this;
551
567
  }
552
568
 
@@ -2543,6 +2559,21 @@ class MixFireworks extends MixCustom {
2543
2559
  }
2544
2560
  }
2545
2561
 
2562
+ class MixNVIDIA extends MixCustom {
2563
+ getDefaultConfig(customConfig) {
2564
+
2565
+ if (!process.env.NVIDIA_API_KEY) {
2566
+ throw new Error('NVIDIA API key not found. Please provide it in config or set NVIDIA_API_KEY environment variable.');
2567
+ }
2568
+
2569
+ return super.getDefaultConfig({
2570
+ url: 'https://integrate.api.nvidia.com/v1/chat/completions',
2571
+ apiKey: process.env.NVIDIA_API_KEY,
2572
+ ...customConfig
2573
+ });
2574
+ }
2575
+ }
2576
+
2546
2577
  class MixGoogle extends MixCustom {
2547
2578
  getDefaultConfig(customConfig) {
2548
2579
  return super.getDefaultConfig({
@@ -2819,4 +2850,4 @@ class MixGoogle extends MixCustom {
2819
2850
  }
2820
2851
  }
2821
2852
 
2822
- module.exports = { MixCustom, ModelMix, MixAnthropic, MixMiniMax, MixOpenAI, MixOpenAIResponses, MixOpenAIWebSocket, MixOpenRouter, MixPerplexity, MixOllama, MixLMStudio, MixGroq, MixTogether, MixGrok, MixCerebras, MixGoogle, MixFireworks };
2853
+ module.exports = { MixCustom, ModelMix, MixAnthropic, MixMiniMax, MixOpenAI, MixOpenAIResponses, MixOpenAIWebSocket, MixOpenRouter, MixPerplexity, MixOllama, MixLMStudio, MixGroq, MixTogether, MixGrok, MixCerebras, MixGoogle, MixFireworks, MixNVIDIA };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelmix",
3
- "version": "4.5.10",
3
+ "version": "4.5.14",
4
4
  "description": "🧬 Reliable interface with automatic fallback for AI LLMs.",
5
5
  "main": "index.js",
6
6
  "repository": {
package/test/setup.js CHANGED
@@ -29,6 +29,7 @@ process.env.GROQ_API_KEY = process.env.GROQ_API_KEY || 'gsk_test-dummy-key-for-t
29
29
  process.env.TOGETHER_API_KEY = process.env.TOGETHER_API_KEY || '49a96test-dummy-key-for-testing-purposes';
30
30
  process.env.XAI_API_KEY = process.env.XAI_API_KEY || 'xai-test-dummy-key-for-testing-purposes';
31
31
  process.env.CEREBRAS_API_KEY = process.env.CEREBRAS_API_KEY || 'csk-test-dummy-key-for-testing-purposes';
32
+ process.env.NVIDIA_API_KEY = process.env.NVIDIA_API_KEY || 'nvapi-test-dummy-key-for-testing-purposes';
32
33
  process.env.GEMINI_API_KEY = process.env.GEMINI_API_KEY || 'AIzatest-dummy-key-for-testing-purposes';
33
34
  process.env.LAMBDA_API_KEY = process.env.LAMBDA_API_KEY || 'secret_test-dummy-key-for-testing-purposes';
34
35
  process.env.BRAVE_API_KEY = process.env.BRAVE_API_KEY || 'BSA0test-dummy-key-for-testing-purposes_fm';