collab: Add support for overage billing for Claude Sonnet 4 (#31206)

This PR adds support for billing for overages for Claude Sonnet 4.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-05-22 14:40:06 -04:00 committed by GitHub
parent cc428330a9
commit 37f49ce304
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1499,6 +1499,12 @@ async fn sync_model_request_usage_with_stripe(
.get_active_zed_pro_billing_subscriptions(user_ids)
.await?;
let claude_sonnet_4 = stripe_billing
.find_price_by_lookup_key("claude-sonnet-4-requests")
.await?;
let claude_sonnet_4_max = stripe_billing
.find_price_by_lookup_key("claude-sonnet-4-requests-max")
.await?;
let claude_3_5_sonnet = stripe_billing
.find_price_by_lookup_key("claude-3-5-sonnet-requests")
.await?;
@ -1532,6 +1538,10 @@ async fn sync_model_request_usage_with_stripe(
let model = llm_db.model_by_id(usage_meter.model_id)?;
let (price, meter_event_name) = match model.name.as_str() {
"claude-sonnet-4" => match usage_meter.mode {
CompletionMode::Normal => (&claude_sonnet_4, "claude_sonnet_4/requests"),
CompletionMode::Max => (&claude_sonnet_4_max, "claude_sonnet_4/requests/max"),
},
"claude-3-5-sonnet" => (&claude_3_5_sonnet, "claude_3_5_sonnet/requests"),
"claude-3-7-sonnet" => match usage_meter.mode {
CompletionMode::Normal => (&claude_3_7_sonnet, "claude_3_7_sonnet/requests"),