Every plan: AI answers included. Your dashboard: what each workspace’s AI cost you this month, and across all of them.Ledger shows what each customer costs you in AI, so you know your margin on every account and every plan. Track each model call’s cost to Ledger as it happens, in a fixed unit of $0.0001, and Ledger keeps the total per customer. Make each workspace its own Ledger customer to see the cost per workspace. Pick the feature type by whether the customer pays for that cost:
With a metered feature
Anunlimited: true item allows every use and records its quantity, so the feature tracks your cost without limiting or billing the customer.
request_id, so a retry records it once.
balance.used adds up every quantity tracked since the billing period began:
Response (features entry)
resetsAt is when the period ends and used starts again from 0, so read it before then to keep each period’s figure.
With a credits feature
When customers pay for usage at cost, the cost is already in Ledger: each call’squantity is what it cost you, in credits (Prepaid dollar balance). Read a month’s total per customer:
Response
customerId for the month across every customer. GET /v1/usage lists each call with its chargedCredits, for a breakdown by request.
Rules
quantityis a whole number, at least 1 on a metered feature. Round each call up to the next $0.0001; that adds at most $0.0001 per call.- One track is at most 2,147,483,647 units, $214,748.36 at this scale.
- Usage totals’
chargedCreditssums credits features. A metered feature’s units are in itsbalance; totals count its calls ineventsandcharged. - Totals are by UTC month of the customer’s time;
balance.usedis by billing period. - Each workspace is a customer for its own totals. Entities split one customer’s credits within its totals.
Related
- Prepaid dollar balance: bill the same cost to the customer.
- Usage events: what each track records.
- Metered allowances: unlimited items.