Add subscription tier monthly document generation limit check on /api/generate #1193

Open
opened 2026-04-12 19:34:31 -04:00 by pook · 0 comments
Owner

Before processing a /api/generate request, check the user's subscription tier and monthly document count. Free tier: 3 documents/month. Pro tier: 50 documents/month. If limit exceeded, return 403 with message 'Monthly document limit reached. Upgrade your plan for more generations.' Track count in a simple generation_counts table: { user_id, month, count }. This is a revenue blocker — without tier enforcement, all users can generate unlimited documents for free.

Acceptance criteria:

  1. Query generation_counts for user_id + current month before OpenAI call
  2. Free tier capped at 3/month, pro at 50/month
  3. 403 response with upgrade message on limit exceeded
  4. Increment count after successful generation
  5. Reset count on month rollover (query checks month column)

Generated by CEO Planner (priority: 3)

Before processing a /api/generate request, check the user's subscription tier and monthly document count. Free tier: 3 documents/month. Pro tier: 50 documents/month. If limit exceeded, return 403 with message 'Monthly document limit reached. Upgrade your plan for more generations.' Track count in a simple generation_counts table: { user_id, month, count }. This is a revenue blocker — without tier enforcement, all users can generate unlimited documents for free. Acceptance criteria: 1. Query generation_counts for user_id + current month before OpenAI call 2. Free tier capped at 3/month, pro at 50/month 3. 403 response with upgrade message on limit exceeded 4. Increment count after successful generation 5. Reset count on month rollover (query checks month column) --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1193
No description provided.