fix(usage): price updated provider defaults

This commit is contained in:
Tam Nhu Tran committed 2026-06-19 09:57:49 -04:00
1 parent 20e315ba3f
commit 34123a62a6
3 files changed
+59 -3

No files matched your search

+22 -2
View File
@@ -531,8 +531,14 @@ const PRICING_REGISTRY: Record<string, ModelPricing> = {
},
// ---------------------------------------------------------------------------
// 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<string, ModelPricing> = {
},
// ---------------------------------------------------------------------------
// 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,
+13 -1
View File
@@ -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);
}
});
+24
View File
@@ -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'];