All tools / AI cost & reliability
holdfirst
Hold the worst-case cost of every AI call before it is sent, against a credit that runs out.
Buy holdfirst for $49One payment of $49, plus sales tax where it applies, and every future update. Delivered as a private GitHub repository you're invited to.
Runs inside Lina. Extracted from the spend engine that keeps the build-time AI jobs behind Lina and our other products inside a prepaid credit.
See it work
holdfirst demo | sed -n '4,14p'
2. A reading of the billing page: $25.00 left, expires 2030-03-11, stop $2.50 early.
ceiling $22.50, spent $0.00, left $22.50
3. A call that fits: the worst case is held while it runs, the real cost is what the ledger keeps.
held $0.0023 (worst case $0.0023), recorded $0.0014, held now $0.0000
4. A batch of 20 long rewrites whose worst case could pass the ceiling is refused before it is sent.
worst case $58.01: CeilingReached: refused: spent $0.00 + held $0.00 + this $58.01 > ceiling $22.50 (backfill:rewrite)
5. A per-job cap in caps.json: everything named nightly... may spend one cent a month.
CapReached: refused by cap nightly (month 2030-03): spent $0.0014 + held $0.0000 + this $0.0090 > $0.01 (nightly:digest)
What it does
holdfirst sets aside the worst-case cost of each AI call before your code sends it, and refuses the call that could pass your ceiling, a per-job cap or the credit's expiry date. The ceiling follows what your billing page says is left. It calls no model, holds no key and needs nothing beyond the standard library.
- Hold first, then call
- Before a call is sent, its worst case (every input token at the dearest rate it could be charged, and the whole output allowance) is set aside. If spent plus held plus this call would cross the line, the call is refused before it leaves your machine. Forty workers cannot each spend the same last dollar.
- A ceiling that follows the credit
- You tell it what the billing page says: the credit left now and when it expires. The ceiling is the ledger at that reading plus the credit left, minus a buffer you choose. Take a new reading any time and drift never builds up. One second after the expiry, nothing is spent.
- Per-job caps
- A hand-edited file caps jobs by name prefix, per month and in total: nightly at $20 a month, evals at $50 since March. A job is checked against every prefix it falls under, and money held for calls in flight counts.
- A ledger with no prompt in it
- One line per billed call: when, which job, the model, token counts, dollars and a request id. Never a prompt, a reply or a key. A call that was made and never recorded is written at its full held amount, marked assumed, so no call ever looks free.
- Your prices, and unlisted models priced high
- Costs come only from a per-million-token table you write, with long-context cards, cache rates and batch factors. No prices are bundled. A model with no row is priced at the dearest rate of every column, so a surprise over-counts.
- Reads the usage your SDK returns
- Token counts come from OpenAI Chat Completions and Responses, Anthropic Messages and Gemini usage objects, as dicts or SDK objects, with cached tokens counted the way each one reports them. Any other shape is refused rather than guessed, and you pass dollars instead.
- Fails closed
- A malformed credit file, caps file, price table or ledger line, or a misspelled dollar amount in the environment, refuses every call until it is fixed. With no credit and no fixed ceiling it refuses too: it will not guess a limit. One halt stops every process on the folder.
- Guards your bill, not your customers'
- llmledger meters what each of your customers uses and enforces their plan. holdfirst guards the one bill you pay yourself: nightly jobs, evals, backfills and agents on a prepaid credit, a grant or a fixed monthly budget.
What you get
holdfirst 1.0.0: the Python library and the holdfirst command, an example price table and caps file, a runnable example and the test suite, with 255 automated tests.
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.
Requirements
Python 3.10 or newer. Python 3.10 or newer, standard library only, on macOS or Linux. Your own vendor SDK makes the calls; the demo needs none.
How buying works
- Enter your GitHub username. You'll see the account before you pay, so you can check it's yours.
- Pay $49, 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/holdfirst/invitations. Invitations expire after 7 days; you can get a new one any time. - Clone and install:
git clone https://github.com/dominares-tools/holdfirst.gitPrivate repo: sign in to GitHub on this computer first. Run
gh auth loginand choose HTTPS, or give git a personal access token when it asks for a password. To use an SSH key instead, clonegit@github.com:dominares-tools/holdfirst.git.python3 -m venv .venv && . .venv/bin/activate pip install ./holdfirst
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?
Payments are handled by Stripe, which works out sales tax. Your receipt and card statement show Link (LINK.COM*), Stripe's checkout service.
Something wrong?
Email support@dominares.org. Every buyer of a tool shares its repository, so support happens by email rather than in GitHub issues.