Context
Following #3116 (user-facing API key management), this issue tracks adding usage-based metered billing so API call volume can be charged beyond flat-rate plan limits.
What exists today
- Flat-rate subscription plans via Dodo (Free, Pro, API Starter, API Business, Enterprise)
- Entitlements with
apiRateLimit values per tier (0 / 60 / 300 / 1000 req/min) — stored but not enforced
- Dodo SDK installed (
dodopayments npm package) — includes usage-events resource, currently unused
- Dodo webhook pipeline (signature-verified, idempotent) handling subscription lifecycle events
- IP-based rate limiting via Upstash Redis sliding window
What's needed
Metering infrastructure
Dodo configuration
Enforcement
Frontend
Dependencies
Open questions
- Hard cap at plan limit vs. allow overage with per-call billing?
- Billing granularity — per request, per 1K requests, daily?
- Which endpoints are metered — all authenticated API calls, or only specific premium endpoints?
🤖 Generated with Claude Code
Context
Following #3116 (user-facing API key management), this issue tracks adding usage-based metered billing so API call volume can be charged beyond flat-rate plan limits.
What exists today
apiRateLimitvalues per tier (0 / 60 / 300 / 1000 req/min) — stored but not enforceddodopaymentsnpm package) — includesusage-eventsresource, currently unusedWhat's needed
Metering infrastructure
usage-eventsAPIDodo configuration
Enforcement
apiRateLimitper user-key (depends on feat(auth): user-facing API key management (create / list / revoke) #3116)Frontend
Dependencies
Open questions
🤖 Generated with Claude Code