Chapter 3 of 15

Build a Cost Ledger, Not Just a Dashboard

A dashboard is useful for seeing spend. A ledger is what lets me explain it. I want each AI event to carry enough context that I can reconstruct who caused the cost, why it happened, what model was used, whether it succeeded, and what business object it belonged to.

  • Usage-event schema
  • Run and workflow IDs
  • Customer and organisation attribution
  • BYOK versus platform-funded usage
  • Reconciliation against provider invoices

The situation

Once multiple models and customers exist, provider dashboards become fragmented. Each provider has its own terminology and reporting lag, and none of them knows my product concepts such as organisation, project, plan, workflow, or successful completion.

The naive solution

Pull provider totals into one finance spreadsheet at the end of the month.

The hidden constraint

Monthly totals cannot explain a spike caused by one runaway agent, an abuse pattern, a product release, a customer import, or an internal test environment. By then the causal context may be gone.

The decision

Create an internal usage ledger at the moment cost is incurred. Provider invoices are then used for reconciliation, not as the primary source of product-level attribution.

The implementation

A cost event should usually contain organisation/customer ID, user ID where appropriate, project or business object ID, workflow/run ID, feature, provider, model, input units, output units, cached units if relevant, estimated cost, BYOK/platform-funded status, environment, timestamp, success/failure status, and a reason code for retries or repair. I would store provider request IDs too where available so discrepancies can be investigated.

The tradeoff

Estimated real-time cost can differ slightly from the final invoice because provider pricing and billing semantics can change. I treat the ledger as operational truth and reconcile it to provider billing rather than pretending the estimate is perfect.

The evidence I would look for

The ledger is doing its job when finance can reconcile totals, engineering can trace anomalies to runs, product can compare features, and support can understand a customer's usage without opening several provider consoles.

The reusable lesson

If cost attribution depends on a provider dashboard, the business does not really own its AI cost model yet.

The consultant's questions

  • Can spend be broken down by customer, feature, environment, and workflow?
  • Can you distinguish BYOK usage from spend funded by your own account?
  • Do you retain provider request IDs for reconciliation?
  • Can an engineer trace a spend spike back to the exact runs that created it?