Skip to content

Add operator/architect plans to mobile app + chat message limits #6830

@beastoin

Description

@beastoin

Summary

Add the new Operator and Architect subscription plans to the mobile app so users can purchase them, and implement chat message limits with backend enforcement and mobile paywall.

Acceptance Criteria

1. Mobile plans sheet shows 3-tier display (Neo / Operator / Architect)

  • Plans sheet displays all 3 tiers as separate selectable cards
  • Monthly/Yearly billing period toggle at the top
  • Each tier card shows: plan name, subtitle (e.g. "2000 questions per month"), price, badges (Popular, Current, Ends on date)
  • Users can select a tier and billing period, then tap Upgrade to purchase

2. Chat message limits enforced

  • Free users: 30 messages/month. When hit, backend rejects (HTTP 402) and mobile shows paywall
  • Neo users: 2000 messages/month. When hit, show paywall to upgrade to Operator/Architect
  • Operator users: 500 messages/month
  • Architect users: $400/month compute budget cap
  • Mobile pre-checks quota via GET /v1/users/me/usage-quota before sending each message
  • Paywall bottom sheet shows usage info + "Upgrade Plan" button leading to plans sheet

3. Backend changes

  • Update NEO_CHAT_QUESTIONS_PER_MONTH default from 200 to 2000
  • Add plan_id, subtitle, eyebrow fields to PricingOption response so mobile can group plans by tier

Technical Notes

  • Backend chat enforcement already exists (enforce_chat_quota in utils/subscription.py) behind CHAT_CAP_ENFORCEMENT_ENABLED kill-switch
  • Backend returns HTTP 402 with structured JSON when quota exceeded
  • Mobile needs to handle both proactive quota check and 402 fallback
  • Version gating: NEW_PLANS_MIN_MOBILE_VERSION already set to 1.0.530, current build is 1.0.532

Files affected

  • backend/utils/subscription.py — Neo cap update
  • backend/routers/payment.py — PricingOption model update
  • app/lib/models/chat_quota.dart — New model
  • app/lib/backend/http/api/users.dart — New API call
  • app/lib/providers/message_provider.dart — Quota enforcement
  • app/lib/pages/chat/page.dart — Paywall trigger
  • app/lib/pages/chat/widgets/chat_quota_paywall.dart — New paywall widget
  • app/lib/pages/settings/widgets/plans_sheet.dart — 3-tier display

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions