Example scenario (illustrative). A team runs four agents against paid model APIs. The app shows token totals per feature. Finance asks which team pays. No one can answer.
The counter lacks an owner, a price snapshot and a provider reference.
Two documented limits
Counting is not billing. FOCUS 1.2 defines BilledCost as the charge used for invoicing in BillingCurrency; it reflects applicable discounts and excludes amortization of eligible advance purchases (FOCUS BilledCost). An application counter alone cannot establish that amount.
Counting is also not lineage. W3C PROV-DM links entities, activities and responsible agents; an association identifies an agent’s responsibility for an activity. PROV records lineage and does not certify the output’s correctness (PROV-DM). Treat an attribution record as evidence, not truth.
Steps
- Assign one owner per run before it starts. Record
team_idfrom the caller’s auth context, not from a prompt. - Stamp every call with a fixed field set. A missing field is an attribution gap, not a default.
- Keep the usage ledger and the invoice ledger apart. Do not overwrite one with the other.
- Snapshot the unit price with a timestamp. Old records must keep old prices.
- Reconcile on a schedule, and store the reconciliation output as the audit artifact.
Illustrative fields, not executed: run_id, team_id, agent_id, model, input_tokens, output_tokens, unit_price_ref, price_snapshot_at, provider_request_id.
Test
Inputs: one day of usage records and provider invoice lines for the same account and window. Observe tokens per team_id against the corresponding invoice line.
A mismatch is not automatically an error; documented adjustments such as discounts and amortization can move the two numbers apart. Classify each difference against the invoice terms. A zero difference is not proof of correctness; confirm the datasets are independent and cover the same scope.
If the gap is large, check missing provider_request_id, stale price_snapshot_at, and calls that bypassed the wrapper. Fix the wrapper.
If a team shows zero spend, confirm it ran nothing; missing records look the same.
Boundaries
For one team on one prepaid key, the overhead may exceed the value. Skip it when the provider already gives per-key breakdowns that you reconcile monthly.
The record supports defensible answers to finance, not accuracy.
This article was created with AI assistance.
Top comments (0)