From dab6dde9e720f14897c9026b3b5eefdd0732a9dc Mon Sep 17 00:00:00 2001 From: shanu Date: Wed, 8 Apr 2026 18:04:55 +0530 Subject: [PATCH] refactor(billing): update terminology from "5-hour" to "10-hour" for consistency across billing components - Updated comments and variable names in the billingHelpers, InferenceBudget, SubscriptionPlans, and Conversations components to reflect the new 10-hour rolling inference window. - Adjusted UI labels and descriptions to ensure clarity regarding the 10-hour cap and its implications for users. - Enhanced the TeamUsage interface documentation to accurately describe the rolling inference window and its associated limits. --- app/src/components/settings/panels/BillingPanel.tsx | 2 +- .../settings/panels/billing/InferenceBudget.tsx | 2 +- .../settings/panels/billing/SubscriptionPlans.tsx | 2 +- app/src/components/settings/panels/billingHelpers.ts | 1 + app/src/pages/Conversations.tsx | 6 +++--- app/src/services/api/creditsApi.ts | 12 +++++++++--- app/src/types/api.ts | 1 + 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/src/components/settings/panels/BillingPanel.tsx b/app/src/components/settings/panels/BillingPanel.tsx index e42aa125824..3f52389cc48 100644 --- a/app/src/components/settings/panels/BillingPanel.tsx +++ b/app/src/components/settings/panels/BillingPanel.tsx @@ -410,7 +410,7 @@ const BillingPanel = () => { 7-day cycle budget: {formatUsdAmount(currentPlan.weeklyBudgetUsd)} - 5-hour cap: {formatUsdAmount(currentPlan.fiveHourCapUsd)} + 10-hour cap: {formatUsdAmount(currentPlan.fiveHourCapUsd)} {currentPlanMeta && ( <> diff --git a/app/src/components/settings/panels/billing/InferenceBudget.tsx b/app/src/components/settings/panels/billing/InferenceBudget.tsx index 6c8006ef66d..6026d622e56 100644 --- a/app/src/components/settings/panels/billing/InferenceBudget.tsx +++ b/app/src/components/settings/panels/billing/InferenceBudget.tsx @@ -46,7 +46,7 @@ const InferenceBudget = ({ teamUsage, isLoadingCredits }: InferenceBudgetProps)
- 5-hour cap: ${teamUsage.fiveHourSpendUsd.toFixed(2)} / $ + 10-hour cap: ${teamUsage.fiveHourSpendUsd.toFixed(2)} / $ {teamUsage.fiveHourCapUsd.toFixed(2)} diff --git a/app/src/components/settings/panels/billing/SubscriptionPlans.tsx b/app/src/components/settings/panels/billing/SubscriptionPlans.tsx index 240b9a3468d..eb87f44afab 100644 --- a/app/src/components/settings/panels/billing/SubscriptionPlans.tsx +++ b/app/src/components/settings/panels/billing/SubscriptionPlans.tsx @@ -111,7 +111,7 @@ const SubscriptionPlans = ({ 7-day cycle: {formatUsdAmount(plan.weeklyBudgetUsd)} - 5-hour cap: {formatUsdAmount(plan.fiveHourCapUsd)} + 10-hour cap: {formatUsdAmount(plan.fiveHourCapUsd)} Discount: {plan.discountPercent}% diff --git a/app/src/components/settings/panels/billingHelpers.ts b/app/src/components/settings/panels/billingHelpers.ts index 6f1244e3286..55cf4117943 100644 --- a/app/src/components/settings/panels/billingHelpers.ts +++ b/app/src/components/settings/panels/billingHelpers.ts @@ -12,6 +12,7 @@ export interface PlanMeta { annualPrice: number; monthlyBudgetUsd: number; weeklyBudgetUsd: number; + /** USD cap per 10-hour rolling inference window; amount scales with `tier` (FREE / BASIC / PRO). */ fiveHourCapUsd: number; discountPercent: number; storageLimitBytes: number; diff --git a/app/src/pages/Conversations.tsx b/app/src/pages/Conversations.tsx index 75c4258b6ce..219f8faba38 100644 --- a/app/src/pages/Conversations.tsx +++ b/app/src/pages/Conversations.tsx @@ -1170,7 +1170,7 @@ const Conversations = () => {

{teamUsage.remainingUsd <= 0 ? 'Weekly inference budget exhausted. Top up to continue.' - : `5-hour rate limit reached.${teamUsage.fiveHourResetsAt ? ` Resets ${formatResetTime(teamUsage.fiveHourResetsAt)}.` : ''}`} + : `10-hour rate limit reached.${teamUsage.fiveHourResetsAt ? ` Resets ${formatResetTime(teamUsage.fiveHourResetsAt)}.` : ''}`}

{teamUsage.remainingUsd <= 0 && ( @@ -1189,7 +1189,7 @@ const Conversations = () => { {teamUsage ? (
0 ? Math.min(1, teamUsage.fiveHourSpendUsd / teamUsage.fiveHourCapUsd) @@ -1216,7 +1216,7 @@ const Conversations = () => {
- 5-hour limit + 10-hour limit ${teamUsage.fiveHourSpendUsd.toFixed(2)} / $ {teamUsage.fiveHourCapUsd.toFixed(2)} diff --git a/app/src/services/api/creditsApi.ts b/app/src/services/api/creditsApi.ts index 78ed8856b13..898f13ce6e9 100644 --- a/app/src/services/api/creditsApi.ts +++ b/app/src/services/api/creditsApi.ts @@ -12,11 +12,17 @@ export interface TeamUsage { dailyUsage: number; totalInputTokensThisCycle: number; totalOutputTokensThisCycle: number; - /** 5-hour rolling window: amount spent (USD) */ + /** + * Rolling inference window: USD spent in the last 10 hours (server-enforced window). + * JSON field name is historical (`fiveHour*`). + */ fiveHourSpendUsd: number; - /** 5-hour rolling window: cap for the user's plan (USD) */ + /** + * Max USD allowed in that 10-hour rolling window for the current subscription tier + * (FREE / BASIC / PRO). Backend sets the amount; the window length is fixed server-side. + */ fiveHourCapUsd: number; - /** ISO timestamp when the oldest 5-hour window entry expires (null if window is empty) */ + /** ISO timestamp when the oldest rolling-window entry expires (null if window is empty) */ fiveHourResetsAt: string | null; /** ISO timestamp when the current weekly cycle started */ cycleStartDate: string; diff --git a/app/src/types/api.ts b/app/src/types/api.ts index 80f2ca20db1..d3a0b8f53e5 100644 --- a/app/src/types/api.ts +++ b/app/src/types/api.ts @@ -76,6 +76,7 @@ export interface CurrentPlanData { subscription: { id: string; status: string; currentPeriodEnd: string; quantity: number } | null; monthlyBudgetUsd: number; weeklyBudgetUsd: number; + /** Max USD per 10-hour rolling inference window for this plan tier (server field name: fiveHourCapUsd). */ fiveHourCapUsd: number; }