Usage Lab records billing-grade usage events for AI and SaaS products: tokens, API calls, jobs, bytes, seats. It dedupes retries, handles late events, rolls everything up per customer per month, ready for your invoices (API or CSV). On Pro and Ultra, it can push monthly totals to your Stripe Billing Meters (beta).
Try the playground (no signup) See the live end-to-end demo Meter your AI app (quickstart)You already bill through Stripe and want usage-based pricing without moving your whole billing stack.
Your usage numbers live with you, are exportable and portable. Switch billers without re-instrumenting your product.
No sales call, no implementation project, no percentage of your revenue.
POST /api/v1/usage with one event or a batch of 100.
Send an Idempotency-Key. A retry returns the original event and is never counted twice.
Events up to 30 days late roll into the month they happened.
Tokens, requests, or monthly active users. Pick an aggregation per meter.
GET /api/v1/meters/:meter/rollups?month=YYYY-MM gives quantity per customer.
Automatic delta push of monthly totals to your own Stripe Billing Meters, set up from your account page. Included in Pro and Ultra. How it works.
Create a meter, send an event, send it again: it counts once. API is live at https://usage-lab.pages.dev. Get a free key first.
# 1. Create the meter once (409 meter_exists on re-run is fine)
curl -X POST https://usage-lab.pages.dev/api/v1/meters \
-H "Authorization: Bearer $USAGE_LAB_KEY" -H "Content-Type: application/json" \
-d '{"key":"llm_tokens","aggregation":"sum"}'
# 2. Send an event with an Idempotency-Key (reuse it on retries)
curl -X POST https://usage-lab.pages.dev/api/v1/usage \
-H "Authorization: Bearer $USAGE_LAB_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: req_8f2c1" \
-d '{"meter":"llm_tokens","subscription":"cus_123","value":1500}'
# 201 {"event":{"status":"created","id":"evt_…","month":"2026-10"},"duplicate":false}
# same call again -> 200 {"event":{"status":"duplicate","id":"evt_…"},"duplicate":true}
# 3. Month-to-date total per customer (add &format=csv for CSV)
curl "https://usage-lab.pages.dev/api/v1/meters/llm_tokens/rollups?month=$(date -u +%Y-%m)" \
-H "Authorization: Bearer $USAGE_LAB_KEY"
# {"total_quantity":1500,"rollups":[{"subscription":"cus_123","quantity":1500,"event_count":1, …}]}
You pay a flat monthly fee for events per month and meters, in Canadian dollars. Never a percentage of your revenue.
Checkout is in Stripe test mode during early access; no real charges yet.
| Usage Lab | Full billing platforms | |
|---|---|---|
| Starts at | $0, then flat CAD plans | Contact sales, or a monthly floor plus a % of billing |
| Scope | Meter + monthly rollups (API/CSV); Stripe push (beta) | Replace your billing stack |
| Your invoices | Stay in Stripe | Move to the platform |
Paste event JSON or a batch; see exact API errors, warnings and the normalized event. Embeddable.
LLM tokens or events: revenue, cost, margin, break-even price. Embeddable.
One-file helper for OpenAI, Anthropic and Vercel AI SDK; check per-token pricing margins.
Validate an event in your browser: ledger row, response, and and the Stripe meter event body Stripe push sends.
Real requests and responses: dedupe and rollups.
curl + Node: OpenAI/Anthropic tokens to a monthly total.
Input and output tokens per customer, retry-safe, never blocks the response.
Quickstart, auth, ingestion, idempotency, rollups, errors.
curl, Node, Python, retry-safe pattern, Cloudflare Worker middleware.
What a billing-grade meter needs.
Stop retries from double-billing.
Replays, the 30-day window and adjustments.
Usage Lab vs Stripe meters, Orb, Lago and Metronome: prices with sources and when each fits.
An honest comparison.
Usage Lab vs OpenMeter (now Kong), with a CloudEvents migration sample.
Usage Lab vs Lago (open-source billing), with an event migration sample.
Count agent and MCP tool calls per customer as real usage, dedupe retries, read rollups.
Usage Lab vs Amberflo (metering, billing and AI cost platform), with a mapping sample.
What small SaaS teams use instead.
OpenAI/Anthropic usage to monthly billing totals.
When Stripe meters are enough, and when you need both.
The API and free signup are live. Pro and Ultra checkout runs in Stripe test mode during early access:
Free needs no checkout: get a key in seconds. Stripe push (beta) is included in Pro and Ultra.