modelmix 2.8.0 → 2.8.4

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.
@@ -10,7 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^0.20.9",
13
- "dotenv": "^16.4.5"
13
+ "dotenv": "^16.4.7"
14
14
  }
15
15
  },
16
16
  ".api/apis/pplx": {
@@ -102,9 +102,9 @@
102
102
  }
103
103
  },
104
104
  "node_modules/dotenv": {
105
- "version": "16.4.5",
106
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
107
- "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
105
+ "version": "16.4.7",
106
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
107
+ "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
108
108
  "engines": {
109
109
  "node": ">=12"
110
110
  },
package/demo/package.json CHANGED
@@ -10,6 +10,6 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^0.20.9",
13
- "dotenv": "^16.4.5"
13
+ "dotenv": "^16.4.7"
14
14
  }
15
15
  }
package/index.js CHANGED
@@ -426,6 +426,9 @@ class MixCustom {
426
426
 
427
427
  class MixOpenAI extends MixCustom {
428
428
  getDefaultConfig(customConfig) {
429
+ if (!customConfig.apiKey && !process.env.OPENAI_API_KEY) {
430
+ throw new Error('OpenAI API key not found. Please provide it in customConfig or set OPENAI_API_KEY environment variable.');
431
+ }
429
432
  return super.getDefaultConfig({
430
433
  url: 'https://api.openai.com/v1/chat/completions',
431
434
  prefix: ['gpt', 'ft:', 'o3', 'o1'],
@@ -469,6 +472,9 @@ class MixOpenAI extends MixCustom {
469
472
 
470
473
  class MixAnthropic extends MixCustom {
471
474
  getDefaultConfig(customConfig) {
475
+ if (!customConfig.apiKey && !process.env.ANTHROPIC_API_KEY) {
476
+ throw new Error('Anthropic API key not found. Please provide it in customConfig or set ANTHROPIC_API_KEY environment variable.');
477
+ }
472
478
  return super.getDefaultConfig({
473
479
  url: 'https://api.anthropic.com/v1/messages',
474
480
  prefix: ['claude'],
@@ -502,6 +508,9 @@ class MixAnthropic extends MixCustom {
502
508
 
503
509
  class MixPerplexity extends MixCustom {
504
510
  getDefaultConfig(customConfig) {
511
+ if (!customConfig.apiKey && !process.env.PPLX_API_KEY) {
512
+ throw new Error('Perplexity API key not found. Please provide it in customConfig or set PPLX_API_KEY environment variable.');
513
+ }
505
514
  return super.getDefaultConfig({
506
515
  url: 'https://api.perplexity.ai/chat/completions',
507
516
  prefix: ['llama-3', 'mixtral'],
@@ -586,6 +595,9 @@ class MixLMStudio extends MixCustom {
586
595
 
587
596
  class MixGroq extends MixCustom {
588
597
  getDefaultConfig(customConfig) {
598
+ if (!customConfig.apiKey && !process.env.GROQ_API_KEY) {
599
+ throw new Error('Groq API key not found. Please provide it in customConfig or set GROQ_API_KEY environment variable.');
600
+ }
589
601
  return super.getDefaultConfig({
590
602
  url: 'https://api.groq.com/openai/v1/chat/completions',
591
603
  prefix: ["llama", "mixtral", "gemma", "deepseek-r1-distill"],
@@ -603,6 +615,9 @@ class MixGroq extends MixCustom {
603
615
 
604
616
  class MixTogether extends MixCustom {
605
617
  getDefaultConfig(customConfig) {
618
+ if (!customConfig.apiKey && !process.env.TOGETHER_API_KEY) {
619
+ throw new Error('Together API key not found. Please provide it in customConfig or set TOGETHER_API_KEY environment variable.');
620
+ }
606
621
  return super.getDefaultConfig({
607
622
  url: 'https://api.together.xyz/v1/chat/completions',
608
623
  prefix: ["meta-llama", "google", "NousResearch", "deepseek-ai"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modelmix",
3
- "version": "2.8.0",
3
+ "version": "2.8.4",
4
4
  "description": "🧬 ModelMix - Unified API for Diverse AI LLM.",
5
5
  "main": "index.js",
6
6
  "repository": {