Now in public beta
AI billing in 3 lines of code
Stop stitching together Stripe, RevenueCat, and token calculators. One SDK, one dashboard, done.
// check, call, track
const { allowed } = await billing.check(userId);
const response = await openai.chat.completions.create({ ... });
await billing.track(userId, response);Features
Everything you need for AI billing
One SDK replaces the entire billing stack. Set up in minutes, not weeks.
Auto-detect providers
Works with Anthropic, OpenAI, OpenRouter, Vercel AI SDK. Zero config.
Stripe + Apple IAP
Connect Stripe for web. RevenueCat for iOS/Android. One dashboard.
Credit system
Monthly plans with token limits. Block when exhausted. No surprise bills.
How it works
Up and running in 3 steps
1
Install the SDK
npm install ai-billing2
Define plans in the dashboard
Dashboard screenshot placeholder
3
Add check() and track()
import { Billing } from "ai-billing";
const billing = new Billing({ apiKey: process.env.AI_BILLING_KEY });
// Before the AI call
const { allowed } = await billing.check(userId);
if (!allowed) throw new Error("Credits exhausted");
// After the AI call
await billing.track(userId, response);Pricing
Start free. Scale when you're ready.
No credit card required for the free plan.
Integrations
Supported providers
Works with every major AI provider and payment processor.
Anthropic
OpenAI
OpenRouter
Google
Stripe
RevenueCat