Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/components/settings/panels/BillingPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ const BillingPanel = () => {
7-day cycle budget: {formatUsdAmount(currentPlan.weeklyBudgetUsd)}
</span>
<span className="rounded-full border border-stone-200 bg-stone-50 px-2 py-1 text-[10px] text-stone-600">
5-hour cap: {formatUsdAmount(currentPlan.fiveHourCapUsd)}
10-hour cap: {formatUsdAmount(currentPlan.fiveHourCapUsd)}
</span>
{currentPlanMeta && (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const InferenceBudget = ({ teamUsage, isLoadingCredits }: InferenceBudgetProps)
</div>
<div className="mt-1 flex items-center justify-between">
<span className="text-[11px] text-stone-500">
5-hour cap: ${teamUsage.fiveHourSpendUsd.toFixed(2)} / $
10-hour cap: ${teamUsage.fiveHourSpendUsd.toFixed(2)} / $
{teamUsage.fiveHourCapUsd.toFixed(2)}
</span>
<span className="text-[11px] text-stone-500">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const SubscriptionPlans = ({
7-day cycle: {formatUsdAmount(plan.weeklyBudgetUsd)}
</span>
<span className="rounded-full border border-stone-200 bg-stone-50 px-2 py-1 text-[10px] text-stone-600">
5-hour cap: {formatUsdAmount(plan.fiveHourCapUsd)}
10-hour cap: {formatUsdAmount(plan.fiveHourCapUsd)}
</span>
<span className="rounded-full border border-stone-200 bg-stone-50 px-2 py-1 text-[10px] text-stone-600">
Discount: {plan.discountPercent}%
Expand Down
1 change: 1 addition & 0 deletions app/src/components/settings/panels/billingHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions app/src/pages/Conversations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ const Conversations = () => {
<p className="text-xs text-coral-600 truncate">
{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)}.` : ''}`}
</p>
</div>
{teamUsage.remainingUsd <= 0 && (
Expand All @@ -1189,7 +1189,7 @@ const Conversations = () => {
{teamUsage ? (
<div className="flex items-center gap-2">
<LimitPill
label="5h"
label="10h"
usedPct={
teamUsage.fiveHourCapUsd > 0
? Math.min(1, teamUsage.fiveHourSpendUsd / teamUsage.fiveHourCapUsd)
Expand All @@ -1216,7 +1216,7 @@ const Conversations = () => {
<div className="absolute bottom-full right-0 mb-2 hidden group-hover:block z-50">
<div className="bg-stone-900 text-white text-[10px] rounded-lg px-3 py-2 shadow-lg whitespace-nowrap space-y-1.5">
<div className="flex items-center justify-between gap-4">
<span className="text-stone-400">5-hour limit</span>
<span className="text-stone-400">10-hour limit</span>
<span>
${teamUsage.fiveHourSpendUsd.toFixed(2)} / $
{teamUsage.fiveHourCapUsd.toFixed(2)}
Expand Down
12 changes: 9 additions & 3 deletions app/src/services/api/creditsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions app/src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Loading