modelmix 4.5.12 → 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
  ```
@@ -166,7 +167,7 @@ Here's a comprehensive list of available methods:
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 | 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
@@ -520,6 +520,8 @@ class ModelMix {
520
520
  }
521
521
 
522
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 }));
523
525
  if (mix.openrouter) return this.attach('minimax/minimax-m2.7', new MixOpenRouter({ options, config }));
524
526
  if (mix.minimax) return this.attach('MiniMax-M2.7', new MixMiniMax({ options, config }));
525
527
  if (mix.together) return this.attach('MiniMaxAI/MiniMax-M2.7', new MixTogether({ options, config }));
@@ -528,14 +530,22 @@ class ModelMix {
528
530
 
529
531
  deepseekV4Pro({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
530
532
  mix = { ...this.mix, ...mix };
533
+ if (mix.nvidia) this.attach('deepseek-ai/deepseek-v4-pro', new MixNVIDIA({ options, config }));
531
534
  if (mix.fireworks) this.attach('accounts/fireworks/models/deepseek-v4-pro', new MixFireworks({ options, config }));
532
535
  if (mix.openrouter) this.attach('deepseek/deepseek-v4-pro', new MixOpenRouter({ options, config }));
533
536
  if (mix.together) this.attach('deepseek-ai/DeepSeek-V4-Pro', new MixTogether({ options, config }));
534
537
  return this;
535
538
  }
536
539
 
540
+ deepseekV4Flash({ options = {}, config = {}, mix = { nvidia: true } } = {}) {
541
+ mix = { ...this.mix, ...mix };
542
+ if (mix.nvidia) this.attach('deepseek-ai/deepseek-v4-flash', new MixNVIDIA({ options, config }));
543
+ return this;
544
+ }
545
+
537
546
  GLM51({ options = {}, config = {}, mix = { fireworks: true } } = {}) {
538
547
  mix = { ...this.mix, ...mix };
548
+ if (mix.nvidia) this.attach('z-ai/glm-5.1', new MixNVIDIA({ options, config }));
539
549
  if (mix.fireworks) this.attach('accounts/fireworks/models/glm-5p1', new MixFireworks({ options, config }));
540
550
  if (mix.openrouter) this.attach('z-ai/glm-5.1', new MixOpenRouter({ options, config }));
541
551
  if (mix.together) this.attach('zai-org/GLM-5.1', new MixTogether({ options, config }));
@@ -2549,6 +2559,21 @@ class MixFireworks extends MixCustom {
2549
2559
  }
2550
2560
  }
2551
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
+
2552
2577
  class MixGoogle extends MixCustom {
2553
2578
  getDefaultConfig(customConfig) {
2554
2579
  return super.getDefaultConfig({
@@ -2825,4 +2850,4 @@ class MixGoogle extends MixCustom {
2825
2850
  }
2826
2851
  }
2827
2852
 
2828
- 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.12",
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';