Lite
Free
MIT · open source
- Metering core (withMeter)
- OpenAI extractor & cost calc
- Basic dashboard
- Memory store
Token metering · Quotas · Credits · Billing
Drop-in token metering, quotas, prepaid credits and Stripe billing for
Next.js AI apps. One withAiGuard wrapper — self-hosted,
your data, one-time purchase.
export const POST = withAiGuard(handler, {
quota: { tokens: 5_000_000, per: 'month' },
spendCap: { cents: 5_000 },
onExceed: 'block',
});Simulated terminal: two requests succeed and are metered; the third is blocked with 402 quota_exceeded once the monthly cap is reached. Zero overspend.
Simulated output.
What you get
Per-user token quotas and hard monthly spend limits. 402, not surprise bills.
Wallets, sub-wallets, Stripe top-ups and auto-recharge.
Switch to a cheaper model automatically before blocking anyone.
Metered subscriptions, webhooks (basil + legacy) and CSV invoices.
Orgs, roles, invites, audit log — with owner anti-lockout.
Sliding window per user. Memory, Postgres or Redis stores.
Per-model margins and next-period spend projection.
The dashboard in the screenshots ships with the package.
Included
Live replica of the included console — sample data.
Sample console data: $24.32 spend this period, up 65% versus the previous 15 days, 2.0M tokens used, 40% of quota, 31.2k requests. By model: gpt-4o $11.43, claude-sonnet-5 $7.54, gpt-4o-mini $3.65, claude-haiku-4-5 $1.70 — each carrying roughly a 23% margin.
React components · Dark & light themes · WCAG AA · Ships with the package
How it works
Clone the private repo that comes with your license and add it to your workspace.
import { withAiGuard } from 'meterkit';
export const POST = withAiGuard(chatHandler, {
quota: { tokens: 5_000_000, per: 'month' },
});Every request is metered, priced and enforced. The console reads the same store.
Positioning
Observability tools (Helicone, Langfuse) tell you what you spent. MeterKit decides whether the request runs at all.
| MeterKit | Observability SaaS | Build it yourself | |
|---|---|---|---|
| Blocks overspend before it happens | ✓ | ✗ — watches, alerts after | Eventually |
| Prepaid credits, quotas & billing | ✓ | ✗ | Weeks of work |
| Your data stays in your database | ✓ | ✗ — their servers | ✓ |
| Pricing | One-time | Monthly, per event | Your time |
EARLY BIRD −25% · FIRST 20 SALES OR 2 WEEKS
Free
MIT · open source
€59 (was €79)
1 company · unlimited devs
€149 (was €199)
Unlimited client projects
One-time payment · 1 year of updates · 14-day refund, no questions · VAT handled at checkout
FAQ
Private repo access with the full TypeScript source (no obfuscation), Drizzle migrations, the React console, docs and the test suite. You own what you deploy.
One company (or individual) can use MeterKit in any number of its own products, with unlimited developers. Client work for third parties requires the Agency tier, which grants your clients rights limited to the delivered project.
You get every release for 1 year via the private repo. Versions you received are yours forever — the license to use them is perpetual.
14 days, no questions asked. Lemon Squeezy (the merchant of record) processes refunds and handles VAT.
Email support at dev@meterkit.dev, best-effort within 48h. Agency licenses get priority responses within 24h.
Next.js 14+ or any Node 18.17+ backend, TypeScript. Postgres is optional (a memory store ships for dev). Stripe is optional — quotas, credits and budgets work without it.
Almost none — the guard runs in-process, with no proxy hop through a third-party service. Only the pre-call checks sit on the hot path; usage recording happens after the response. Measured with the micro-benchmark that ships in the repo: under 0.05 ms overhead with the in-memory store, and about 1 ms against a local Postgres (add your app-to-database round-trip in production). Both are noise next to an LLM call.
MeterKit runs inside your app with your data. No per-event fees, no vendor between you and your users, nothing to keep paying for the code you already run.
Yes. Usage extractors are duck-typed — anything that reports token usage can be metered, and per-model pricing is fully configurable.