Skip to content

Commit df127d4

Browse files
Programcodeclaude
andcommitted
Move the quota migrations past the cost-logging migration's timestamp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 60e3d06 commit df127d4

4 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎.claude/skills/verify-debatelab/features/usage-limits.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Usage limits: weighted daily quota and monthly AI budget
22

3-
The daily AI allowance counts units, not requests. An expensive model uses several units per request (Claude Opus 5.5 counts as 5, Sonnet 5.5 as 2, cheap models as 1), so a request that does not fit in what is left today is refused with a message that names the model's weight and the units left, while a lighter model still runs. Separately, once a user's logged AI spend for the current UTC month reaches the monthly budget ($3 by default), every AI request is refused with its own dialog until the 1st of next month. The weights, the budget and the tier defaults live in `supabase/functions/_shared/usage-limits.ts`; the reservation is `consume_daily_quota` in `supabase/migrations/20261022120001_weighted_quota_monthly_budget.sql`.
3+
The daily AI allowance counts units, not requests. An expensive model uses several units per request (Claude Opus 5.5 counts as 5, Sonnet 5.5 as 2, cheap models as 1), so a request that does not fit in what is left today is refused with a message that names the model's weight and the units left, while a lighter model still runs. Separately, once a user's logged AI spend for the current UTC month reaches the monthly budget ($3 by default), every AI request is refused with its own dialog until the 1st of next month. The weights, the budget and the tier defaults live in `supabase/functions/_shared/usage-limits.ts`; the reservation is `consume_daily_quota` in `supabase/migrations/20261022130001_weighted_quota_monthly_budget.sql`.
44

55
## Sub-features
66

‎supabase/functions/_shared/entitlements.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export async function checkRateLimit(userId: string | null, model?: ModelSelecti
177177
// Atomically reserve today's quota units server-side so concurrent requests
178178
// can't race past the limit. Expensive models reserve several units, and
179179
// the same call refuses users over the monthly AI budget (see
180-
// 20261022120001_weighted_quota_monthly_budget.sql).
180+
// 20261022130001_weighted_quota_monthly_budget.sql).
181181
const units = quotaUnitsFor(model);
182182
const { data: quota, error: quotaError } = await supabase.rpc("consume_daily_quota", {
183183
p_user_id: userId,

supabase/migrations/20261022120000_index_ai_requests_user_created.sql renamed to supabase/migrations/20261022130000_index_ai_requests_user_created.sql

File renamed without changes.

supabase/migrations/20261022120001_weighted_quota_monthly_budget.sql renamed to supabase/migrations/20261022130001_weighted_quota_monthly_budget.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
-- denied_by reports which limit refused the call: 'daily' or 'monthly'.
1313
-- The weights and the cap live in supabase/functions/_shared/usage-limits.ts.
1414
-- The month's spend is read through idx_ai_requests_user_created
15-
-- (20261022120000_index_ai_requests_user_created.sql).
15+
-- (20261022130000_index_ai_requests_user_created.sql).
1616

1717
-- New parameters and a new result column change the signature, so remove the
1818
-- old overload first and keep exactly one. Only service-role Edge Functions

0 commit comments

Comments
 (0)