Add Scale plan, pay-as-you-go top-ups and auto recharge - #137
Merged
Merged
Conversation
Plans now change only rate limits and included credits: Pro stays $20/10x and Scale is $200/month with $200 of usage and 100x limits. Pay-as-you-go top-ups ($5-$1,000) credit purchased funds only after invoice-verified reconciliation, and owners can enable auto recharge with an amount, a balance threshold and an optional calendar-month maximum enforced by a claimed-attempt ledger. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (31)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plans now change only rate limits and included credits, and workspaces can pay as they go.
Plans
rateLimitMultiplierinsrc/lib/billing.ts) instead of the hardcodedfunded ? 10 : 1, on both the spending path and the legacy path. The unusedmaxtier is removed.Pay as you go
top_upplan ($1 = 100,000 credits). Purchased funds never expire and are credited only after the paid invoice is verified, exactly once per invoice id (app_autumn_topups). Refunds revoke once; consumed usage is not reverse-charged.auto_top_up_*columns, finally wired). A claimed attempt row (app_auto_topup_attempts) is the single-flight lock, the one-hour failure cooldown, and the monthly-cap ledger, so concurrent settlements cannot double-charge or exceed the cap. The charge usesbilling.attachwithredirect_mode: "never"against the saved payment method; crediting always goes through invoice-verified reconciliation. Triggers: post-settlement hook in the spending path + a 5-account scheduled sweep.billing.setup_paymentlink), return-from-checkout refresh.AUTUMN_SCALE_PLAN_ID/AUTUMN_TOPUP_PLAN_ID(already set in prod); everything degrades gracefully when unset.Verified end to end (Autumn sandbox + Stripe test mode, real dev server)
auto_top_up; the 4th blocked by the $30/month cap; single-flight and cooldown observed.billing_plan='scale', +$200 credits, monthly reset set.Production Autumn already has
scaleandtop_uppushed (additive; Pro untouched), and migration0016_pay_as_you_go.sqlapplies on deploy.Tests: 861 pass (14 new: auto-top-up engine, top-up/Scale reconciliation, per-plan rate limits e2e), typecheck and CLI suites green.
🤖 Generated with Claude Code
Summary by CodeRabbit