fix(pricing): restore opus version order; cover 4.6/4.7 fast-tier rates

Address presto review on the fast-tier work:

- Move the claude-opus-4-8 entry after claude-opus-4-7-thinking so the
  registry keeps chronological 4.6 -> 4.7 -> 4.8 ordering (the 4.8 insert
  had split the 4-7 / 4-7-thinking pair).
- Drop the fast serviceTier from claude-opus-4-7-thinking: that id is a
  legacy pricing-only entry with no catalog model, so a fast premium on it
  is meaningless. The active 4.6-thinking variant (agy provider) keeps its
  fast tier.
- Extend the 4.7 fast-tier test with cache-rate assertions and add an
  equivalent 4.6 fast-tier test so the derived buildRates math is covered
  for every premium-tier model.

Built [OnSteroids](https://onsteroids.ai)
This commit is contained in:
Sergey Galuza
2026-05-31 18:52:54 +02:00
parent e8057a7073
commit 5a79b47506
2 changed files with 17 additions and 9 deletions
+6 -9
View File
@@ -296,6 +296,12 @@ const PRICING_REGISTRY: Record<string, ModelPricing> = {
fast: OPUS_46_47_FAST_RATES,
},
},
'claude-opus-4-7-thinking': {
inputPerMillion: 5.0,
outputPerMillion: 25.0,
cacheCreationPerMillion: 6.25,
cacheReadPerMillion: 0.5,
},
// Claude 4.8 Opus ($5/$25) — fast mode ($10/$50, 2x premium per Anthropic docs)
'claude-opus-4-8': {
inputPerMillion: 5.0,
@@ -306,15 +312,6 @@ const PRICING_REGISTRY: Record<string, ModelPricing> = {
fast: OPUS_48_FAST_RATES,
},
},
'claude-opus-4-7-thinking': {
inputPerMillion: 5.0,
outputPerMillion: 25.0,
cacheCreationPerMillion: 6.25,
cacheReadPerMillion: 0.5,
serviceTiers: {
fast: OPUS_46_47_FAST_RATES,
},
},
// ---------------------------------------------------------------------------
// OpenAI Models - Source: better-ccusage
+11
View File
@@ -200,6 +200,17 @@ describe('model-pricing', () => {
const opus47fast = getModelPricing('claude-opus-4-7', { serviceTier: 'fast' });
expect(opus47fast.inputPerMillion).toBe(30.0);
expect(opus47fast.outputPerMillion).toBe(150.0);
expect(opus47fast.cacheCreationPerMillion).toBe(37.5); // 30 * 1.25
expect(opus47fast.cacheReadPerMillion).toBe(3.0); // 30 * 0.1
});
it('should return fast-tier pricing for Claude Opus 4.6 when serviceTier=fast', () => {
// Fast mode on 4.6 carries the same 6x premium as 4.7 ($30/$150).
const opus46fast = getModelPricing('claude-opus-4-6', { serviceTier: 'fast' });
expect(opus46fast.inputPerMillion).toBe(30.0);
expect(opus46fast.outputPerMillion).toBe(150.0);
expect(opus46fast.cacheCreationPerMillion).toBe(37.5); // 30 * 1.25
expect(opus46fast.cacheReadPerMillion).toBe(3.0); // 30 * 0.1
});
it('should apply fast-tier pricing together with date-suffix stripping', () => {