modelmix 5.0.6 → 5.1.2

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.
@@ -0,0 +1,12 @@
1
+ const { expect } = require('chai');
2
+
3
+ const { ModelMix } = require('../index.js');
4
+ const { listChainModelShortcuts } = require('../lib/model-chain');
5
+
6
+ describe('model chain catalog', () => {
7
+ it('contains only implemented ModelMix shortcuts', () => {
8
+ for (const shortcut of listChainModelShortcuts()) {
9
+ expect(ModelMix.prototype[shortcut], shortcut).to.be.a('function');
10
+ }
11
+ });
12
+ });
@@ -100,7 +100,7 @@ describe('OpenAI moderation', () => {
100
100
  it('rejects generative providers from the moderation chain', () => {
101
101
  const model = ModerationMix.new();
102
102
 
103
- expect(() => model.gpt41nano()).to.throw(
103
+ expect(() => model.gpt5nano({ config: { apiKey: 'test-key' } })).to.throw(
104
104
  'ModerationMix only accepts moderation providers.'
105
105
  );
106
106
  });
@@ -0,0 +1,54 @@
1
+ const { expect } = require('chai');
2
+
3
+ const api = require('../index.js');
4
+
5
+ describe('public module boundary', () => {
6
+ it('preserves the CommonJS export surface', () => {
7
+ expect(Object.keys(api).sort()).to.deep.equal([
8
+ 'MixAnthropic',
9
+ 'MixCerebras',
10
+ 'MixCustom',
11
+ 'MixFireworks',
12
+ 'MixGoogle',
13
+ 'MixGrok',
14
+ 'MixGroq',
15
+ 'MixKimi',
16
+ 'MixLMStudio',
17
+ 'MixMiMo',
18
+ 'MixMiniMax',
19
+ 'MixModeration',
20
+ 'MixNVIDIA',
21
+ 'MixOllama',
22
+ 'MixOpenAI',
23
+ 'MixOpenAIModeration',
24
+ 'MixOpenAIResponses',
25
+ 'MixOpenAIWebSocket',
26
+ 'MixOpenRouter',
27
+ 'MixPerplexity',
28
+ 'MixTogether',
29
+ 'ModelMix',
30
+ 'ModerationMix',
31
+ 'applyUnifiedEffort',
32
+ 'normalizeEffort',
33
+ 'resolveProviderFamily'
34
+ ]);
35
+ });
36
+
37
+ it('preserves provider inheritance and class identity', () => {
38
+ expect(Object.getPrototypeOf(api.MixOpenAIResponses.prototype)).to.equal(api.MixOpenAI.prototype);
39
+ expect(Object.getPrototypeOf(api.MixOpenAIModeration.prototype)).to.equal(api.MixModeration.prototype);
40
+ expect(Object.getPrototypeOf(api.ModerationMix.prototype)).to.equal(api.ModelMix.prototype);
41
+ expect(require('../index.js').MixCustom).to.equal(api.MixCustom);
42
+ });
43
+
44
+ it('keeps root exports usable by model shortcuts', () => {
45
+ const model = api.ModelMix.new().qwen35397b({ config: { apiKey: 'test-key' } });
46
+
47
+ expect(model.models).to.have.length(1);
48
+ expect(model.models[0].provider.constructor).to.equal(api.MixOpenRouter);
49
+ });
50
+
51
+ it('keeps the mutable pricing catalog private', () => {
52
+ expect(require('../lib/token-usage')).to.not.have.property('MODEL_PRICING');
53
+ });
54
+ });
@@ -576,6 +576,26 @@ describe('Token Usage Tracking', () => {
576
576
  }
577
577
  });
578
578
 
579
+ it('should register GPT-OSS 120B through the current OpenRouter model ID', function () {
580
+ const originalOpenRouterApiKey = process.env.OPENROUTER_API_KEY;
581
+ process.env.OPENROUTER_API_KEY = 'test-openrouter-key';
582
+
583
+ try {
584
+ const model = ModelMix.new().gptOss({
585
+ mix: { cerebras: false, groq: true, openrouter: true, together: false }
586
+ });
587
+
588
+ expect(model.models.map(({ key }) => key)).to.deep.equal([
589
+ 'openai/gpt-oss-120b',
590
+ 'openai/gpt-oss-120b'
591
+ ]);
592
+ expect(model.models[1].provider).to.be.instanceOf(MixOpenRouter);
593
+ } finally {
594
+ if (originalOpenRouterApiKey === undefined) delete process.env.OPENROUTER_API_KEY;
595
+ else process.env.OPENROUTER_API_KEY = originalOpenRouterApiKey;
596
+ }
597
+ });
598
+
579
599
  it('should use api-key header for MiMo provider', function () {
580
600
  const originalMimoApiKey = process.env.MIMO_API_KEY;
581
601
  process.env.MIMO_API_KEY = 'test-mimo-key';