prmpt.bio is a generative media platform. Every gen calls paid models, gens fail halfway, creators earn from other people's unlocks and tips, and some of that money leaves as bank transfers. So credits must never appear from nothing, disappear, or be spent twice.
I built its money on one rule: every movement is a posting, and a posting's legs sum to zero. This page is how that works.
The model
Lot
A batch of credits with one origin: a pack someone bought, a grant, or earnings converted back into credits. 100 credits are one dollar.
Position
Where a lot's credits sit: available, escrowed, spent, refunded, voided, or forfeited when an account is deleted. A lot's positions always add up to its size.
Posting
One money movement, with a cause: an escrow, a settlement, a release, a tip, an unlock, a refund, a payout, and so on.
Leg
One line of a posting: so many credits into or out of one position of a lot, or of the platform. A posting's legs sum to zero. A new credit is never created from nothing: its other leg is the platform's mint.
One gen, as postings
A gen runs one prompt on one or several models. Before it starts, the person sees an exact quote, one line per model at the settings they chose. If the price drifts before they press, it refuses and quotes again. Then:
The whole quote is escrowed at once, taken lot by lot in a fixed spend order: credits with no purchase behind them first, then packs, each group oldest first. That keeps the newest pack untouched, and so refundable, for as long as anything else can pay.
Each model's result settles on its own, at the price on its quote line, once its pictures or video have passed the safety check and been delivered. A result that delivers three of the four pictures asked pays for three; one whose every output is dropped is never charged.
When the gen ends, completed, failed, canceled or expired, whatever never settled is released back to the lots it came from. A result that never ran is never charged.
A gen on three models quoted at 120 credits, 40 each, where the first model delivers, the second fails and the third never starts:
Posting
Leg
Credits
escrow
lot A, available
−120
lot A, escrowed
+120
settlement, line 1
lot A, escrowed
−40
lot A, spent
+40
release
lot A, escrowed
−80
lot A, available
+80
Each posting sums to zero. The person paid 40 for the one result that delivered. A tip or an unlock is a single posting of its own: the payer's credits move to spent, and the platform mints the creator's earnings, with the fee as its own leg. The payer's credits stay spent and never become someone else's cash.
Exactly once
Postings never change. The database refuses any update or delete of a posting or its legs. Lot balances move only in the same transaction as the posting that moves them, and no money record is ever deleted. A mistake is corrected by a new posting.
Duplicates cannot be written. Unique indexes refuse a second settlement of the same quote line, a second hold or release of the same escrow, a second refund of the same pack, and a second payout of the same request. A retried job or a webhook that arrives twice moves the money once.
One transaction per movement. Spending locks the payer's lots in spend order. Settlements and releases of one escrow are serialized on that escrow.
Earnings, fees and the rounding law
Unlocks and tips credit the creator as earnings, net of the platform's 10% fee on each. Earnings are provisional for 30 days. After that they convert into credits at parity, or, from $100, cash out as a bank transfer, with the transfer's cost passed through.
Credits are whole numbers, so every fee has to round. Rounding each payment on its own would let someone split one large payment into many tiny ones and pay no fee at all. Instead the fee floors on the running total between that payer and that creator, per kind of payment: whatever way a total is split, the fees add up to the one cut on the whole, with less than one credit of rounding left over at any moment, in the creator's favour.
Credits can't be cashed out or moved between accounts, and no account can ever pay itself. Every payment from one account to another pays its fee, so a ring of accounts trading with each other can only lose.
Refunds and chargebacks
A pack can be refunded only whole: the database accepts a pack refunded in full or not at all. The buyer can ask within 14 days, once in 30 days, if not one of its credits was ever spent; credits that went into an escrow and came back do not count. The refund waits until nothing of the pack is held for a gen, and the credits move to refunded only when the payment provider confirms it.
A card issuer's fraud warning on an untouched pack refunds it straight away. A chargeback or a fraud warning freezes the account: new spending, buying, converting, cashing out and deleting the account all refuse, while gens already paid for finish. A lost chargeback voids what is left of that pack, and any credit a later release would have returned to it. Earnings the pack already paid to creators stand: the platform takes that loss, not them.
How it is checked
A reconciliation reads the whole ledger and checks every balance against the postings. The tests run it after every single operation, and it can be run by hand against the live ledger. Among its rules:
every posting's legs sum to zero;
every lot's positions equal the legs that touched it, and sum to the lot's size;
no escrow settles more than it holds, and once released its settlements and release add up to it exactly;
every fee collected is the floored cut of its running total;
every refund moved one pack whole, with nothing of it ever spent.
Property-based tests generate random sequences of escrows, settlements, releases, conversions, tips and unlocks, and run the reconciliation after each one. Refunds, chargebacks, the fee rounding and the spend order have property tests of their own.
Decisions, and what they cost
Escrow the whole quote
A gen either has all its money held before it starts, or it doesn't start. Nothing stops halfway for lack of credits, and the price shown is the price paid. The cost: credits sit locked while a long video renders.
Mint earnings, don't move credits
What a creator earns is a separate token, minted by the platform when a tip or an unlock arrives, rather than the payer's credits handed over. That is what keeps bought credits from ever turning into cash. The cost: the two sides are tied by reconciliation rules instead of by one posting.
The platform absorbs chargebacks
When a buyer wins a chargeback, the creators they paid keep their earnings. Creators can trust that money that arrived is theirs. The cost is the platform's, which is why purchases are limited per day by how established an account is.
How it was built
I wrote these rules first, as the specification, then built the ledger with AI coding agents (Claude Code) against them. The rules above are the ones the tests hold it to.