Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/cli/internal/trace/claude/pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type modelPricing struct {
CacheWrite float64 `json:"cache_write"`
// CacheWrite1h is the price per 1M tokens written to the 1-hour prompt cache tier (2x base input).
CacheWrite1h float64 `json:"cache_write_1h"`
// CacheRead is the price per 1M tokens read from the prompt cache (0.1x base input).
// CacheRead is the price per 1M tokens read from the prompt cache (0.1x base input on most models; see pricing.json notes for exceptions).
CacheRead float64 `json:"cache_read"`
}

Expand Down
32 changes: 30 additions & 2 deletions app/cli/internal/trace/claude/pricing.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
{
"version": "2026-08-28",
"version": "2026-10-02",
"source": "https://platform.claude.com/docs/en/about-claude/pricing",
"notes": "cache_write = 5-minute tier (~1.25x base input). cache_write_1h = 1-hour tier (~2x base input). cache_read = ~0.1x base input. Multipliers are approximate; the published rates at the source URL are authoritative and may differ due to rounding (e.g. claude-3-haiku-20240307 cache_write is $0.30, not 0.25 * 1.25 = $0.3125).",
"notes": "cache_write = 5-minute tier (~1.25x base input). cache_write_1h = 1-hour tier (~2x base input). cache_read = ~0.1x base input (0.025x on claude-fable-5-1 / claude-mythos-5-1, 0.05x on claude-opus-5-5). Multipliers are approximate; the published rates at the source URL are authoritative and may differ due to rounding (e.g. claude-3-haiku-20240307 cache_write is $0.30, not 0.25 * 1.25 = $0.3125).",
"default_model": "claude-sonnet-4-6",
"models": {
"claude-fable-5-1": {
"input": 10.00,
"output": 50.00,
"cache_write": 12.50,
"cache_write_1h": 20.00,
"cache_read": 0.25
},
"claude-mythos-5-1": {
"input": 10.00,
"output": 50.00,
"cache_write": 12.50,
"cache_write_1h": 20.00,
"cache_read": 0.25
},
"claude-fable-5": {
"input": 10.00,
"output": 50.00,
Expand All @@ -18,6 +32,13 @@
"cache_write_1h": 20.00,
"cache_read": 1.00
},
"claude-opus-5-5": {
"input": 4.00,
"output": 20.00,
"cache_write": 5.00,
"cache_write_1h": 8.00,
"cache_read": 0.20
},
"claude-opus-5": {
"input": 5.00,
"output": 25.00,
Expand Down Expand Up @@ -46,6 +67,13 @@
"cache_write_1h": 10.00,
"cache_read": 0.50
},
"claude-sonnet-5-5": {
"input": 2.00,
"output": 10.00,
"cache_write": 2.50,
"cache_write_1h": 4.00,
"cache_read": 0.20
},
"claude-sonnet-5": {
"input": 2.00,
"output": 10.00,
Expand Down
20 changes: 20 additions & 0 deletions app/cli/internal/trace/claude/pricing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,23 @@ func TestPricingEmbedLoads(t *testing.T) {
assert.Equal(t, 4.00, sonnet5.CacheWrite1h)
assert.Equal(t, 0.20, sonnet5.CacheRead)
}

func TestPricingModelRates(t *testing.T) {
testCases := []struct {
model string
want modelPricing
}{
{"claude-fable-5-1", modelPricing{Input: 10.00, Output: 50.00, CacheWrite: 12.50, CacheWrite1h: 20.00, CacheRead: 0.25}},
{"claude-mythos-5-1", modelPricing{Input: 10.00, Output: 50.00, CacheWrite: 12.50, CacheWrite1h: 20.00, CacheRead: 0.25}},
{"claude-opus-5-5", modelPricing{Input: 4.00, Output: 20.00, CacheWrite: 5.00, CacheWrite1h: 8.00, CacheRead: 0.20}},
{"claude-sonnet-5-5", modelPricing{Input: 2.00, Output: 10.00, CacheWrite: 2.50, CacheWrite1h: 4.00, CacheRead: 0.20}},
}

for _, tc := range testCases {
t.Run(tc.model, func(t *testing.T) {
got, ok := pricing[tc.model]
require.True(t, ok, "expected %s in embedded pricing table", tc.model)
assert.Equal(t, tc.want, got)
})
}
}
Loading