From de0f8b32642c2eda34efc8d06317f91ee00957ba Mon Sep 17 00:00:00 2001 From: Sergey Galuza Date: Mon, 20 Apr 2026 19:24:43 +0200 Subject: [PATCH] test(model-pricing): add cache pricing coverage for Opus 4.7 Mirrors the existing `claude-opus-4-6` cache pricing test for both `claude-opus-4-7` and `claude-opus-4-7-thinking` to explicitly validate cache creation/read rates in end-to-end cost calculation. Addresses PResto atrvd/ccs#8 issue #6 (suggestion). Built [OnSteroids](https://onsteroids.ai) --- tests/unit/model-pricing.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/model-pricing.test.ts b/tests/unit/model-pricing.test.ts index c73354fc..5abe6cb9 100644 --- a/tests/unit/model-pricing.test.ts +++ b/tests/unit/model-pricing.test.ts @@ -236,6 +236,28 @@ describe('model-pricing', () => { const cost = calculateCost(usage, 'claude-opus-4-6'); expect(cost).toBe(36.75); // 5 + 25 + 6.25 + 0.5 }); + + it('should calculate Claude Opus 4.7 cost including cache token rates', () => { + const usage: TokenUsage = { + inputTokens: 1_000_000, + outputTokens: 1_000_000, + cacheCreationTokens: 1_000_000, + cacheReadTokens: 1_000_000, + }; + const cost = calculateCost(usage, 'claude-opus-4-7'); + expect(cost).toBe(36.75); // 5 + 25 + 6.25 + 0.5 + }); + + it('should calculate Claude Opus 4.7 Thinking cost including cache token rates', () => { + const usage: TokenUsage = { + inputTokens: 1_000_000, + outputTokens: 1_000_000, + cacheCreationTokens: 1_000_000, + cacheReadTokens: 1_000_000, + }; + const cost = calculateCost(usage, 'claude-opus-4-7-thinking'); + expect(cost).toBe(36.75); // 5 + 25 + 6.25 + 0.5 + }); }); describe('getKnownModels', () => {