What is Hardcount?
Hardcount is open-source usage billing software for AI products that charge by token or API call. It tracks customer usage, prices tokens by model and type, creates invoices, and uses Stripe to charge saved cards. Teams run it on their own servers with Postgres and Redis, keeping usage and invoice data in their own database. It is pre-1.0, maintained by one person, has no SDKs or production users yet, and supports Stripe as its only payment processor.
Hardcount Features:
Model-Based Pricing: A single meter can price usage by model and token type, with per-unit, graduated, package, and base-fee-plus-usage pricing options.
Prepaid Credits: Customers can buy credit that later invoices draw down, and your app can read the remaining balance to decide whether to serve more usage.
Customer Invoices: Hardcount creates invoices with separate lines by model and token type, downloadable PDFs, secure hosted invoice pages, and credit notes.
Margin Reporting: Record provider costs per token to compare usage revenue with costs for each customer and model, excluding base fees, credits, and taxes.
Stripe Payments: Stripe charges saved cards, while Hardcount retries failed payments on a schedule and can email customers when email is configured.
Billing Test Clocks: Advance a test customer's clock to simulate a billing period, preview the next invoice, and test charges and retries before going live.
Hardcount Benefits:
Avoid Billing Fees: The MIT-licensed software has no paid edition or percentage fee on billed revenue, leaving server costs and Stripe's payment fees.
See Customer Economics: Comparing revenue with recorded provider costs helps teams spot customers or models where usage may be unprofitable.
Keep Billing Data: Running Hardcount on your own servers keeps usage and invoice records in your Postgres rather than a hosted billing service.
Reduce Billing Errors: Idempotent usage events and safeguards against duplicate invoices help prevent repeat counting and billing for the same period twice.
Test Before Launch: Simulated billing periods let teams inspect invoices and payment behavior without moving real money or waiting for a month to pass.
Use Cases:
AI Token Billing: An AI API team can charge customers different rates for input and output tokens across the models it offers.
API Call Billing: A developer building a usage-priced service can send an event for each billable API call and invoice customers by period.
Prepaid AI Access: A product can sell usage credit in advance and check a customer's balance before continuing to provide AI service.
Model Margin Review: A finance or product lead can compare customer revenue with model-provider costs when deciding how to price AI usage.
Billing Change Tests: An engineer can simulate a month of usage to check a pricing change, invoice lines, and failed-card retries before applying it to live customers.

