What Hardcount does
Usage billing for AI products, from the usage event to the paid invoice, on your own servers.
Price AI usage per model and token type
One meter counts tokens. Each usage event carries labels such as model and token type, and each label combination gets its own price. Ready-made prices for Anthropic-, OpenAI- and Replicate-style pricing are one call away.
Sell prepaid credit
Sell "pay $9k, get $10k of usage". Later invoices use the credit up, free credit first. Your app can read the live balance and stop serving a customer whose credit has run out.
See your margin per customer and model
Enter what each AI provider charges you per token, once. Hardcount shows each customer's usage revenue next to what it cost you, per model. Usage only: base fees, credits and taxes are left out.
Invoices your customers can read
One line per model and token type, a PDF, a hosted invoice page the customer opens from a secure link, credit notes, and tax through Stripe Tax or a flat rate you set.
Get paid, and retry when a card fails
Stripe charges the saved card. When a charge fails, Hardcount retries on your schedule and, once email is set up, emails the customer. When Stripe's answer is unclear, it checks Stripe for the payment before charging again.
Subscriptions and plans
A subscription puts a customer on a plan. Around it:
- Free trials, which you can extend.
- Pausing collection: new invoices stay drafts until you resume.
- Cancelling now, at the end of the period, or at a date you set.
- Plan changes with proration: the customer pays only for the part of the period each price was active.
- A different price for one customer (a price override), or credit. There are no coupons.
- Billing thresholds: an invoice made early once the period's usage reaches a level you set.
- A usage and cost figure your app can show each customer.
- A team: invite people by email. Every member has full access; there are no roles yet.
- Test and live API keys, with test and live data kept apart.
Subscriptions in the API → · API keys → · The usage figure →
Test a change before customers see it
Move a test customer's clock forward and a month of billing happens in seconds: the invoice, the charge, the retries. Preview the next invoice. Everything runs in test mode until you switch to live.
Built for developers
A REST API, usage events that count once even when resent, signed webhooks kept in the database and retried, LiteLLM support with no SDK, CSV exports, and an audit log that Hardcount’s own database user cannot change or delete.
One usage event, sent with curl:
curl -X POST http://localhost:8080/v1/usage-events \
-H "Authorization: Bearer $HARDCOUNT_KEY" \
-H "Content-Type: application/json" \
-d '{"event_name": "tokens",
"external_customer_id": "acme-1",
"quantity": 1200,
"dimensions": {"model": "claude-sonnet-4.5", "token_type": "input"},
"idempotency_key": "req-42:input"}'Run it yourself
One Go program and Postgres, plus Redis for rate limits; the ready-made Docker Compose setup runs five small containers. Your billing data stays in your own database. MIT, with no paid edition and no telemetry.
Every feature
Every route the API has, with what each one does: The Hardcount API →
Everything shipped, by date: Changelog → · What Hardcount does not do: Is it right for you? →
Try it on your computer
Start Hardcount in test mode and run its demo. Found something rough? Open an issue or a Discussion.



