diff --git a/src/web-server/model-pricing.ts b/src/web-server/model-pricing.ts index 25127406..7c01c32e 100644 --- a/src/web-server/model-pricing.ts +++ b/src/web-server/model-pricing.ts @@ -296,6 +296,10 @@ const PRICING_REGISTRY: Record = { fast: OPUS_46_47_FAST_RATES, }, }, + // Legacy pricing-only entry for historical analytics data; this id has no + // catalog model (Opus 4.7 moved to adaptive thinking levels in 84dc4e24, so + // there is no separate -thinking variant). Kept so older usage records still + // resolve to the correct rate. No fast tier: the id is never requested live. 'claude-opus-4-7-thinking': { inputPerMillion: 5.0, outputPerMillion: 25.0, diff --git a/tests/unit/model-pricing.test.ts b/tests/unit/model-pricing.test.ts index 95b6c7f1..16652330 100644 --- a/tests/unit/model-pricing.test.ts +++ b/tests/unit/model-pricing.test.ts @@ -223,6 +223,14 @@ describe('model-pricing', () => { expect(opus48fastDated.cacheReadPerMillion).toBe(1.0); }); + it('should preserve serviceTiers metadata when applying tier rates', () => { + // applyServiceTier must keep the serviceTiers map on the returned object + // so callers can still inspect available tiers after rate substitution. + const opus48fast = getModelPricing('claude-opus-4-8', { serviceTier: 'fast' }); + expect(opus48fast.serviceTiers).toBeDefined(); + expect(opus48fast.serviceTiers?.fast).toBeDefined(); + }); + it('should fall back to standard rates when serviceTier is unknown', () => { // Unknown tier names must not throw; revert to base pricing transparently. const opus48 = getModelPricing('claude-opus-4-8', { serviceTier: 'enterprise-mythos' });