Skip to content

Commit 2832a95

Browse files
wesmclaude
andcommitted
feat(pricing): ship claude-opus-4-7 fallback rates
Opus 4.7 sits at the same tier as Opus 4.6/4.8 ($5/$25 in/out, $6.25/$0.50 cache create/read). LiteLLM already lists it, but the shipped fallback only had 4.6 and 4.8, so offline and fresh-seed runs left 4.7 unpriced. Add a claude-opus-4-7 fallback entry and bump FallbackVersion so the startup seeder re-upserts it, giving the current Opus generation uniform offline coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f47f17d commit 2832a95

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

internal/pricing/fallback.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ 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-05-29"
5+
const FallbackVersion = "2026-05-30"
66

77
// FallbackPricing returns hardcoded pricing for key Claude
88
// models. Used when the LiteLLM fetch fails.
@@ -24,6 +24,13 @@ func FallbackPricing() []ModelPricing {
2424
CacheCreationPerMTok: 6.25,
2525
CacheReadPerMTok: 0.50,
2626
},
27+
{
28+
ModelPattern: "claude-opus-4-7",
29+
InputPerMTok: 5.0,
30+
OutputPerMTok: 25.0,
31+
CacheCreationPerMTok: 6.25,
32+
CacheReadPerMTok: 0.50,
33+
},
2734
{
2835
// Opus 4.8 launched at the Opus 4.6/4.7 rates and is
2936
// not yet in the LiteLLM catalog, so it ships here so

internal/pricing/fallback_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,30 @@ func TestFallbackPricing_Opus46Rates(t *testing.T) {
2929
assert.Equal(t, want, *got)
3030
}
3131

32+
func TestFallbackPricing_Opus47Rates(t *testing.T) {
33+
prices := FallbackPricing()
34+
var got *ModelPricing
35+
for i := range prices {
36+
if prices[i].ModelPattern == "claude-opus-4-7" {
37+
got = &prices[i]
38+
break
39+
}
40+
}
41+
require.NotNil(t, got, "claude-opus-4-7 entry missing from FallbackPricing")
42+
43+
// Opus 4.7 shares the Opus 4.6/4.8 tier. LiteLLM already lists
44+
// it, but the fallback ships it too so offline and fresh-seed
45+
// pricing covers the whole current Opus generation.
46+
want := ModelPricing{
47+
ModelPattern: "claude-opus-4-7",
48+
InputPerMTok: 5.0,
49+
OutputPerMTok: 25.0,
50+
CacheCreationPerMTok: 6.25,
51+
CacheReadPerMTok: 0.50,
52+
}
53+
assert.Equal(t, want, *got)
54+
}
55+
3256
func TestFallbackPricing_Opus48Rates(t *testing.T) {
3357
prices := FallbackPricing()
3458
var got *ModelPricing

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-7": false,
100101
"claude-opus-4-8": false,
101102
"claude-haiku-4-5-20251001": false,
102103
"claude-sonnet-4-20250514": false,

0 commit comments

Comments
 (0)