Automate vendor billing on the hosted platform - #1
Open
adityaaa-IIT-BHU wants to merge 3 commits into
Open
Conversation
keymaker cloud can now charge vendors for the agent traffic it serves,
closing the next roadmap milestone:
- billing-init --platform creates the platform Stripe meter + metered
price and writes <data>/cloud.config.json in one command
- POST /v1/tenants (with billing_email) creates a Stripe customer for
the vendor and subscribes them to the metered price; the response
carries billing: { customer_id, subscription_id, metered_event }, and
a Stripe failure never blocks provisioning
- every metered agent call on a tenant (hosted /mcp + verify) emits a
platform meter event against the vendor's customer via a new onMeter
hook on keymakerGateway, so usage becomes monthly vendor invoices
- provisioned tenants now set meter_at_gateway: their upstreams aren't
keymaker-protected, so the gateway is the only place hosted MCP calls
could be counted (dashboard usage was silently 0 for /mcp before)
- landing form asks for a billing email when billing is on; dashboard
shows the vendor's customer + subscription
Covered by four new tests (mock Stripe + mock upstream); docs updated
in HOSTING.md and the README roadmap.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
…ed invoices Close the revenue loop on keymaker cloud. Vendor billing previously created a subscription with no payment method on file — invoices could never collect. Now it's the standard self-serve SaaS funnel: - provisioning puts every vendor on a FREE plan (Stripe customer, no card): free_calls_per_month metered calls, tracked per tenant in platform.json with serialized writes - past the cap, hosted POST /mcp answers 402 Payment Required with an upgrade link; discovery, signup, and verify stay open - GET/POST /t/<id>/upgrade (admin-token gated) mints a Stripe Checkout session — card on file + metered subscription; once paid it becomes a billing-portal redirect instead - POST /v1/stripe/webhook (signature-verified, timing-safe, 5-min tolerance) flips the plan: checkout.session.completed → metered, customer.subscription.deleted → back to free - meter events only fire for metered-plan tenants, so free traffic is counted but never billed - billing-init --platform gains --free-calls, writes the cap into cloud.config.json, and prints the webhook setup steps - dashboard shows plan + monthly usage + the right billing link; the landing form's provision output shows the plan Vendor billing tests rewritten around the funnel (8 tests: free provision, cap → 402, checkout, webhook upgrade + metering, churn back to free, bad signature, billing off, Stripe failure). 37 tests passing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
…unch kit - startCloud resolved publicUrl from the requested port before listen, so port 0 advertised http://localhost:0 URLs; resolve after bind instead - fly.toml and render.yaml now carry the STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRET wiring needed for vendor billing in production - docs/launch-kit.md: go-live checklist, pricing defaults, channel plan, Show HN + social drafts, and a personalized outreach table built from the 2026-07-28 agent-readiness scan Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN
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.
keymaker cloud can now charge vendors for the agent traffic it serves,
closing the next roadmap milestone:
price and writes /cloud.config.json in one command
the vendor and subscribes them to the metered price; the response
carries billing: { customer_id, subscription_id, metered_event }, and
a Stripe failure never blocks provisioning
platform meter event against the vendor's customer via a new onMeter
hook on keymakerGateway, so usage becomes monthly vendor invoices
keymaker-protected, so the gateway is the only place hosted MCP calls
could be counted (dashboard usage was silently 0 for /mcp before)
shows the vendor's customer + subscription
Covered by four new tests (mock Stripe + mock upstream); docs updated
in HOSTING.md and the README roadmap.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017UDRyxKdTxgMNJaGthzkjN