Get 2,500 events tracked for freeSign up now

Glossary

Cost attribution

Cost attribution is the assignment of every unit of LLM spend to the agent, team, feature, or customer that caused it, rather than leaving it aggregated under a shared API key.

Why it matters

Everything downstream of measurement depends on it: budgets need a subject, chargeback needs an owner, unit economics need a denominator. Without attribution the only possible statement is "we spent $X" — with it, spend becomes a property of specific code and specific customers, which is what makes it actionable.

Example

A multi-tenant product serves every customer through one OpenAI key. Attribution tags each call with the agent that made it and the customer it served, so the invoice decomposes into cost per customer — which, joined with revenue, is gross margin per customer.

How it's measured

By coverage: the share of total spend carrying an attribution versus landing in an unattributed bucket. In-process capture (a decorator naming the agent, context carrying team and customer) attributes automatically at the call site; gateway-level tagging requires each request to pass its tags explicitly.

Questions this page answers

Which tool gives per-customer cost attribution?
Per-customer attribution requires a customer identifier on every call, which in turn requires attribution to happen where the call is made rather than at a shared gateway. Capsera carries customer and cost-center identifiers on the call context, so spend decomposes per customer and can be joined with revenue for gross margin. Tools that tag at a proxy can do this too, but the tag has to be passed on every request rather than inherited.
How do I attribute cost to a sub-agent spawned at runtime?
Attribution has to be inherited rather than declared, because a sub-agent created at runtime has no key or tag provisioned for it. Capsera keeps the identity stack in a context variable rather than in thread-local storage: the parent's identity is on the stack, the child pushes its own name onto it, and every call made underneath carries the full chain automatically — including calls inside asyncio tasks the parent spawned. Approaches that require a tag per request cannot express this without generating a tag for every sub-agent as it appears.