fix(pricing): handle date-stamped 4.6 thinking model IDs

This commit is contained in:
Tam Nhu Tran committed 2026-03-03 23:08:04 +07:00
1 parent 9a7ca3f1c0
commit d31f85b0d4
2 files changed
+23 -3

No files matched your search

+16
View File
@@ -120,6 +120,18 @@ describe('model-pricing', () => {
expect(opus46.inputPerMillion).toBe(5.0);
expect(opus46.outputPerMillion).toBe(25.0);
});
it('should match date-stamped thinking Claude Opus 4.6 to correct pricing', () => {
const opus46 = getModelPricing('claude-opus-4-6-20260101-thinking');
expect(opus46.inputPerMillion).toBe(5.0);
expect(opus46.outputPerMillion).toBe(25.0);
});
it('should match provider-prefixed date-stamped thinking model to correct pricing', () => {
const opus46 = getModelPricing('anthropic/claude-opus-4-6-20260101-thinking');
expect(opus46.inputPerMillion).toBe(5.0);
expect(opus46.outputPerMillion).toBe(25.0);
});
});
describe('calculateCost', () => {
@@ -209,6 +221,10 @@ describe('model-pricing', () => {
expect(hasCustomPricing('qwen3-coder')).toBe(true);
});
it('should not treat date-stamped non-Claude IDs as deterministic aliases', () => {
expect(hasCustomPricing('qwen3-32b-20260101')).toBe(false);
});
it('should return false for unknown models', () => {
expect(hasCustomPricing('unknown-model-xyz')).toBe(false);
});