diff --git a/src/web-server/model-pricing.ts b/src/web-server/model-pricing.ts index 2f36e1a8..9a176882 100644 --- a/src/web-server/model-pricing.ts +++ b/src/web-server/model-pricing.ts @@ -531,8 +531,14 @@ const PRICING_REGISTRY: Record = { }, // --------------------------------------------------------------------------- - // GLM Models (Zhipu AI / Z.AI) - Source: OpenRouter verified pricing + // GLM Models (Zhipu AI / Z.AI) - Source: Official Z.AI pricing // --------------------------------------------------------------------------- + 'glm-5.2': { + inputPerMillion: 1.4, + outputPerMillion: 4.4, + cacheCreationPerMillion: 0.0, + cacheReadPerMillion: 0.26, + }, 'glm-5': { inputPerMillion: 1.0, outputPerMillion: 3.2, @@ -678,8 +684,22 @@ const PRICING_REGISTRY: Record = { }, // --------------------------------------------------------------------------- - // MiniMax Models - Source: https://platform.minimax.io/docs/pricing/pay-as-you-go + // MiniMax Models - Source: https://platform.minimax.io/docs/guides/pricing-paygo // --------------------------------------------------------------------------- + 'MiniMax-M3': { + inputPerMillion: 0.3, + outputPerMillion: 1.2, + cacheCreationPerMillion: 0.0, + cacheReadPerMillion: 0.06, + serviceTiers: { + priority: { + inputPerMillion: 0.45, + outputPerMillion: 1.8, + cacheCreationPerMillion: 0.0, + cacheReadPerMillion: 0.09, + }, + }, + }, 'MiniMax-M2.5': { inputPerMillion: 0.3, outputPerMillion: 1.2, diff --git a/tests/unit/api/provider-presets.test.ts b/tests/unit/api/provider-presets.test.ts index 8d2dc167..75fef442 100644 --- a/tests/unit/api/provider-presets.test.ts +++ b/tests/unit/api/provider-presets.test.ts @@ -29,6 +29,14 @@ describe('provider-presets', () => { expect(preset?.id).toBe('km'); }); + it('tracks current provider default model updates', () => { + expect(getPresetById('glm')?.defaultModel).toBe('glm-5.2'); + expect(getPresetById('glmt')?.defaultModel).toBe('glm-5.2'); + expect(getPresetById('km')?.defaultModel).toBe('kimi-for-coding'); + expect(getPresetById('kimi')?.defaultModel).toBe('kimi-for-coding'); + expect(getPresetById('mm')?.defaultModel).toBe('MiniMax-M3'); + }); + it('resolves llama.cpp preset with local-provider sentinel token', () => { const preset = getPresetById('llamacpp'); expect(preset?.id).toBe('llamacpp'); @@ -110,7 +118,11 @@ describe('provider-presets', () => { for (const preset of PROVIDER_PRESETS) { if (!preset.icon) continue; - const iconPath = resolve(import.meta.dir, '../../../ui/public', preset.icon.replace(/^\/+/, '')); + const iconPath = resolve( + import.meta.dir, + '../../../ui/public', + preset.icon.replace(/^\/+/, '') + ); expect(existsSync(iconPath)).toBe(true); } }); diff --git a/tests/unit/model-pricing.test.ts b/tests/unit/model-pricing.test.ts index dfafe478..7502f674 100644 --- a/tests/unit/model-pricing.test.ts +++ b/tests/unit/model-pricing.test.ts @@ -65,6 +65,30 @@ describe('model-pricing', () => { expect(pricing.inputPerMillion).toBe(0.6); }); + it('should price current provider preset defaults without fallback rates', () => { + const fallback = getModelPricing('unknown-model-xyz'); + + expect(getModelPricing('glm-5.2')).toMatchObject({ + inputPerMillion: 1.4, + outputPerMillion: 4.4, + cacheReadPerMillion: 0.26, + }); + expect(getModelPricing('MiniMax-M3')).toMatchObject({ + inputPerMillion: 0.3, + outputPerMillion: 1.2, + cacheReadPerMillion: 0.06, + }); + expect(getModelPricing('MiniMax-M3', { serviceTier: 'priority' })).toMatchObject({ + inputPerMillion: 0.45, + outputPerMillion: 1.8, + cacheReadPerMillion: 0.09, + }); + + expect(getModelPricing('glm-5.2')).not.toEqual(fallback); + expect(getModelPricing('MiniMax-M3')).not.toEqual(fallback); + expect(getModelPricing('kimi-for-coding')).not.toEqual(fallback); + }); + it('should not use fallback pricing for known Qwen catalog IDs', () => { const fallback = getModelPricing('unknown-model-xyz'); const catalogIds = ['qwen3-235b', 'qwen3-vl-plus', 'qwen3-32b'];