Fair-use request limits subtract payment processing and fixed per-user infrastructure first, then reserve your target gross margin before dividing the remaining budget by the per-request token cost.
StripeFee = PlanPrice > 0 ? (PlanPrice * StripePct / 100) + StripeFixedUSD : 0
NetRevenuePool = PlanPrice - StripeFee - AmortizedInfraPerUser
CostPerReq = (InputTokens * InputRatePer1M + OutputTokens * OutputRatePer1M) / 1,000,000
BreakEvenMonthlyCap = floor(max(0, NetRevenuePool) / CostPerReq)
AllowedAiBudget = max(0, NetRevenuePool - PlanPrice * (TargetMarginPct / 100))
TargetMonthlyCap = floor(AllowedAiBudget / CostPerReq), DailyCap = MonthlyCap / 30
If per-request token cost is zero or allowed AI budget is zero, caps clamp safely without division by zero. Keep a secondary fast model fallback ready when users hit the daily target ceiling.