Skip to content

Commit c36ba91

Browse files
authored
feat(pricing): ship claude-opus-4-7 fallback rates (#571)
Follow-up to #565 (opus-4-8). The shipped fallback table had `claude-opus-4-6` and `claude-opus-4-8` but not `claude-opus-4-7`, so offline runs (`usage daily --offline`) and fresh-seed installs left 4.7 unpriced even though it sits at the same tier ($5/$25 input/output, $6.25/$0.50 cache create/read). LiteLLM already lists 4.7, so online users were unaffected; this closes the offline gap. Adds a `claude-opus-4-7` entry and bumps `FallbackVersion` so the startup seeder re-upserts the fallback table, giving the current Opus generation (4.6/4.7/4.8) uniform offline coverage. Verified by wiping `model_pricing` on a copy of a real database and running `--offline`: 4.6, 4.7, and 4.8 all price from the fallback alone (4.7 was $0 before this change in that scenario). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Wes McKinney <wesm@users.noreply.github.com>
1 parent f47f17d commit c36ba91

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)