Show HN: Hardcount – Self-hosted usage billing for AI products Hardcount v0.9.2, an open-source, self-hosted usage-billing tool for AI products, launched via a Show HN post, letting operators price tokens per model and token type, sell prepaid credit and generate invoices while keeping billing data in their own Postgres. The project positions itself as an alternative to Stripe Billing and Lago, avoiding Stripe Billing's 0.7% fee on billing volume on its pay-as-you-go plan while Stripe still processes the card charge. In the demo, one month of AI usage for one customer produces a $5.73 invoice with a 51.9% margin (Sonnet 67.1%, Haiku 20.0%), and the tool runs in test mode via Docker 24 or newer with the Compose plugin. Usage billing for AI products, on your own servers. Price tokens per model, sell prepaid credit, and see what each customer costs you. Hardcount makes the invoices, and Stripe charges the card. Your billing data stays in your own Postgres. An open-source alternative to Stripe Billing and Lago: no Stripe Billing fee, no paid edition, and light enough to run yourself. Why Hardcount → why-hardcount One month of AI usage for one customer, from the demo quick-start in test mode: one invoice line per model and token type, $5.73 due. Your margin on it is 51.9% Sonnet 67.1%, Haiku 20.0% , shown only to you. ▶ Watch the 65-second walkthrough https://gethardcount.com/ looks , narrated, with captions. Try Hardcount on your own computer. It runs in test mode, where no real money moves. You need git and Docker 24 or newer with the Compose plugin. On Windows, run it inside WSL. 1. Start Hardcount git clone --branch v0.9.2 https://github.com/gethardcount/hardcount.git cd hardcount/deploy/compose ./quickstart.sh You see: "Hardcount is running.", then your dashboard address, email, password and a test API key. The password is shown only once; the script also saves all four in deploy/compose/quickstart-credentials.json . Open http://localhost:8080 and sign in. Hardcount opens in test mode, and it is empty. 2. Run the demo ./quickstart.sh demo The demo sets up AI token prices, creates a customer and sends token usage the way a LiteLLM proxy would. Then it moves the customer's test clock a pretend clock for test customers to the end of the month, and Hardcount makes the invoice, its PDF and the margin report shown above. You see: nine steps, each ending in a green ✓, then links to the invoice and the customer. Home still reads $0, because its totals leave out test-clock customers; use the links instead. Each demo step, and where to click https://github.com/gethardcount/hardcount/blob/main/docs/quick-start.md 3. Stop or remove it ./quickstart.sh stop keeps your data. ./quickstart.sh destroy deletes it, and cannot be undone. If port 8080 is taken, start with HARDCOUNT PORT=9000 ./quickstart.sh . Next: send your own usage and get a first invoice https://github.com/gethardcount/hardcount/blob/main/docs/first-invoice.md · run it for real on one VM https://github.com/gethardcount/hardcount/blob/main/docs/production-one-vm.md · change Hardcount itself https://github.com/gethardcount/hardcount/blob/main/CONTRIBUTING.md development-setup php flowchart LR A "Your app or LiteLLM" -- |"usage events"| B "Hardcount