Skip to content

Commit f6ff6ca

Browse files
wesmclaude
andcommitted
fix(pricing): ship claude-opus-4-8 fallback rates
Opus 4.8 launched at the same rates as Opus 4.6/4.7 ($5/$25 in/out, $6.25/$0.50 cache create/read) but is not yet in the LiteLLM catalog, so the exact-match pricing lookup returned zero rates and usage showed $0 in `usage daily`. Add a claude-opus-4-8 fallback entry and bump FallbackVersion so the startup seeder re-upserts it. The async LiteLLM refresh leaves the row untouched since the upstream catalog has no opus-4-8 key yet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a1c762a commit f6ff6ca

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

internal/pricing/fallback.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ package pricing
22

33
// FallbackVersion must be bumped whenever FallbackPricing
44
// rates change so the startup seeder knows to re-upsert.
5-
const FallbackVersion = "2026-04-13"
5+
const FallbackVersion = "2026-05-28"
66

77
// FallbackPricing returns hardcoded pricing for key Claude
88
// models. Used when the LiteLLM fetch fails.
9-
// Prices in USD per million tokens, current as of 2026-04.
9+
// Prices in USD per million tokens, current as of 2026-05.
1010
func FallbackPricing() []ModelPricing {
1111
return []ModelPricing{
1212
// Current model names (used by Claude Code / Codex)
@@ -24,6 +24,16 @@ func FallbackPricing() []ModelPricing {
2424
CacheCreationPerMTok: 6.25,
2525
CacheReadPerMTok: 0.50,
2626
},
27+
{
28+
// Opus 4.8 launched at the Opus 4.6/4.7 rates and is
29+
// not yet in the LiteLLM catalog, so it ships here so
30+
// usage is priced until LiteLLM adds it.
31+
ModelPattern: "claude-opus-4-8",
32+
InputPerMTok: 5.0,
33+
OutputPerMTok: 25.0,
34+
CacheCreationPerMTok: 6.25,
35+
CacheReadPerMTok: 0.50,
36+
},
2737
{
2838
ModelPattern: "claude-haiku-4-5-20251001",
2939
InputPerMTok: 1.0,

internal/pricing/fallback_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,27 @@ func TestFallbackPricing_Opus46Rates(t *testing.T) {
2828
}
2929
assert.Equal(t, want, *got)
3030
}
31+
32+
func TestFallbackPricing_Opus48Rates(t *testing.T) {
33+
prices := FallbackPricing()
34+
var got *ModelPricing
35+
for i := range prices {
36+
if prices[i].ModelPattern == "claude-opus-4-8" {
37+
got = &prices[i]
38+
break
39+
}
40+
}
41+
require.NotNil(t, got, "claude-opus-4-8 entry missing from FallbackPricing")
42+
43+
// Opus 4.8 launched at the same rates as Opus 4.6/4.7 and is
44+
// not yet in the LiteLLM catalog, so the shipped fallback must
45+
// price it at the current Opus tier.
46+
want := ModelPricing{
47+
ModelPattern: "claude-opus-4-8",
48+
InputPerMTok: 5.0,
49+
OutputPerMTok: 25.0,
50+
CacheCreationPerMTok: 6.25,
51+
CacheReadPerMTok: 0.50,
52+
}
53+
assert.Equal(t, want, *got)
54+
}

internal/pricing/litellm_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func TestFallbackPricing(t *testing.T) {
9797
required := map[string]bool{
9898
"claude-sonnet-4-6": false,
9999
"claude-opus-4-6": false,
100+
"claude-opus-4-8": false,
100101
"claude-haiku-4-5-20251001": false,
101102
"claude-sonnet-4-20250514": false,
102103
"claude-opus-4-20250514": false,

0 commit comments

Comments
 (0)