Meter every customer's AI usage and stop the call before it goes over their allowance.
llmledger records each model call to an append-only monthly ledger and checks a customer's plan allowance before the next call is made. It reads token counts from OpenAI, Gemini and Anthropic responses, prices them from a table you supply, and needs nothing beyond the standard library.
Buy llmledger for $99One payment of $99, plus sales tax where it applies, and every future update. Delivered as a private GitHub repository you're invited to.
What it does
- An append-only usage ledger
- record() writes one line per model call to a monthly file: customer, model, token counts and cost, never the prompt or the reply. A repeated call id is counted once, across threads and processes.
- Admit before you call
- admit(customer, plan) says whether a call may go ahead, from monthly dollar, token or call limits counted from the ledger rather than from chat history a customer can clear. Months begin in the time zone you set.
- Reads provider responses
- Token counts, cached input and cache writes come straight from OpenAI Chat Completions and Responses, Gemini and Anthropic Messages responses, as dicts or SDK objects. A guard wrapper admits, calls and records in one step.
- Your prices, checked
- Costs come only from a per-million-token price table you write in JSON, TOML or a dict; no prices are bundled. An unpriced model records no cost and a warning, or raises in strict mode, and prices check flags placeholders, zero rates and per-thousand mistakes.
- Alerts at 80% and 100%
- Callbacks you supply fire once per customer per month at each threshold. What has fired is stored, so a restart or a second process stays quiet.
- A daily spend ceiling
- A cap across all customers that admit() enforces. A ceiling that cannot be read, a misspelled setting or environment variable name included, stops the program at start-up and never means no ceiling.
- Units and reports
- A separate ledger for usage that isn't tokens, such as call minutes, keyed by event id so two writers agree on one count. llmledger report gives totals per customer and model as text or JSON.
After you buy
pip install ./llmledger
python3 llmledger/examples/quickstart.py
llmledger report --dir quickstart-usage
llmledger prices check llmledger/examples/prices.example.json
What you get
llmledger 1.0.0: the Python library and the llmledger command, with an example price table, a config file and a runnable quickstart, with 248 automated tests. Python 3.10 or newer.
A commercial license. Use it and change it in your own projects and your clients' projects. Don't share or resell the source. Read the license.
Every update. New versions land in the same repository; git pull to get them.
How buying works
- Enter your GitHub username. You'll see the account before you pay, so you can check it's yours.
- Pay $99, plus any sales tax shown at checkout, on Stripe's checkout page.
- Accept the invitation GitHub emails you. Signed in as that account, you'll also find it at
github.com/dominares-tools/llmledger/invitations. Invitations expire after 7 days; you can get a new one any time. - Clone and install:
git clone https://github.com/dominares-tools/llmledger.git pip install ./llmledger
Questions
- Do I need GitHub?
- Yes. Access is a read-only invitation to a private repository, sent to the GitHub account you choose.
- Can I get a refund?
- Yes, within 14 days, no questions asked. Access ends when the refund goes through. Refund policy.
- Who takes the payment?
- Stripe. Your purchase is sold through Link, Stripe's checkout service, which also works out sales tax and sends your receipt.
- Something wrong?
- Email josephlinares02@gmail.com. Every buyer of a tool shares its repository, so support happens by email rather than in GitHub issues.