How cost accounting works
The problem: an LLM platform’s unit economics live or die on one number — what does one published article actually cost? — and that number is surprisingly hard to get. Flat per-call estimates drift from reality (here, a flat constant once under-counted the platform’s dominant cost driver by ~6×); provider dashboards aggregate by account, not by article.
Layer 1 — the immutable usage event
Section titled “Layer 1 — the immutable usage event”Every LLM call emits an immutable usage event carrying the full attribution vector: tenant, contract, record, pipeline, step, model, token counts, timestamp. Not a log line — a queryable ledger row. Nothing about cost is derived at call time; events store facts (tokens, model), and money is computed later.
Layer 2 — the versioned pricebook
Section titled “Layer 2 — the versioned pricebook”Prices change; history must not. Cost is computed by joining events against a versioned pricebook — the price valid at event time — so last month’s numbers stay true after a provider reprices. The same join reconciles the computed total against the provider’s actual invoice: if the ledger and the bill diverge, something is unmetered, and that is a defect, not a rounding note.
Layer 3 — cost of one article, honestly amortized
Section titled “Layer 3 — cost of one article, honestly amortized”“Cost per article” includes more than its Generate run: Collect research that fed it is amortized across the articles it enabled. This is the number the platform actually steers by — it exposed, for example, that a period of post-gate rejects multiplied the effective cost per published article several-fold even though per-call prices never moved. Without per-article attribution that regression is invisible inside a monthly total.
Layer 4 — budgets that act
Section titled “Layer 4 — budgets that act”Metering feeds enforcement: per-run budgets with a kill-switch through the run control channel. A runaway loop stops because the ledger says so — not because someone noticed the invoice three weeks later.
The trade-offs, honestly
Section titled “The trade-offs, honestly”Metering every call costs a write per call and a discipline: any new LLM call path must emit the event, and the reconciliation check exists precisely to catch paths that forget. Amortization rules are a modeling choice — the platform records the raw vectors so the model can be changed retroactively without losing data.
See it in two minutes
Section titled “See it in two minutes”The metering domain in list_domains exposes the read surface; per-run
costs appear in run reports.
Specs: SPEC-107 (usage_event + pricebook), SPEC-022/023 (budgets + kill-switch), SPEC-124 (invoice reconciliation).