collab: Clarify naming around free tier spending limits (#18936)
Marshall Bowers
created
This PR renames the `MONTHLY_SPENDING_LIMIT` constant to
`FREE_TIER_MONTHLY_SPENDING_LIMIT` to clarify it.
This will help distinguish it from the user's specified limit on their
paid monthly spending.
Release Notes:
- N/A
@@ -438,8 +438,9 @@ fn normalize_model_name(known_models: Vec<String>, name: String) -> String {
}
}
-/// The maximum monthly spending an individual user can reach before they have to pay.-pub const MONTHLY_SPENDING_LIMIT: Cents = Cents::from_dollars(5);
+/// The maximum monthly spending an individual user can reach on the free tier
+/// before they have to pay.
+pub const FREE_TIER_MONTHLY_SPENDING_LIMIT: Cents = Cents::from_dollars(5);
/// The maximum lifetime spending an individual user can reach before being cut off.
const LIFETIME_SPENDING_LIMIT: Cents = Cents::from_dollars(1_000);
@@ -462,7 +463,7 @@ async fn check_usage_limit(
.await?;
if state.config.is_llm_billing_enabled() {
- if usage.spending_this_month >= MONTHLY_SPENDING_LIMIT {
+ if usage.spending_this_month >= FREE_TIER_MONTHLY_SPENDING_LIMIT {
if !claims.has_llm_subscription.unwrap_or(false) {
return Err(Error::http(
StatusCode::PAYMENT_REQUIRED,