# Know what every run costs, and who spent it.

RunAgain computes cost on every generation span from its token counts (or a provider-supplied figure), then rolls it up by agent, user, session, version or any metadata you attach. Spend stops being a monthly invoice surprise and becomes a queryable column.

## The problem: The invoice tells you nothing

Your provider bill is one number a month. It cannot tell you which agent burned the budget, which customer's workload got expensive, or which prompt change doubled token use last Tuesday. Cost questions are trace questions, and without traces they go unanswered.

## How RunAgain does it

1. **Cost as a typed column.** Every generation span carries input, output, cache-read, cache-write and reasoning token counts, with cost computed per span or taken from a provider-supplied cost_usd. It aggregates like any other column: no log parsing, no spreadsheet.
2. **Attribution by your dimensions.** User, session, agent, environment, version and tags are promoted to typed fields on every trace, so cost per customer, per tier or per release is a filter, not a data project.
3. **Cache and reasoning visibility.** Cache-read versus cache-write tokens show whether prompt caching is actually paying for itself, and reasoning tokens are surfaced separately so thinking budgets stay visible.
4. **Sessions roll it up.** Multi-turn conversations aggregate cost across every turn, so the economics of a whole support thread or onboarding flow read as one row.

## FAQ

**Q: How do I attribute LLM cost to a specific customer?**

A: Set user.id (or any custom metadata) as a span attribute in your SDK. RunAgain promotes it to a typed column on the trace, so per-customer cost is a filter and an aggregation away. Common vendor attribute aliases are accepted with no mapping.

**Q: Does RunAgain track cache and reasoning tokens?**

A: Yes. Each generation span records input, output, cache-read, cache-write, reasoning and total tokens, and cost is computed from those counts, so caching savings and thinking budgets are visible per span.

**Q: Do I need a proxy or a provider switch to get cost data?**

A: No. Cost is computed from the token counts already on your traces, shipped via the Vercel AI SDK, Claude Agent SDK or any OpenTelemetry SDK. When a provider supplies its own cost figure, that is used instead.

## Built on these solutions

- [Agent observability](https://runagain.ai/solutions/agent-observability.md)
- [Trace enrichment](https://runagain.ai/solutions/enrich-agent-traces.md)
- [Monitoring & alerting](https://runagain.ai/solutions/agent-monitoring-alerting.md)

Book a demo: https://cal.com/tamas-szuromi/30min · Get in touch: tamas@runagain.ai

---

Markdown mirror of https://runagain.ai/use-cases/llm-cost-tracking for agents and LLMs. Append .md to any runagain.ai page URL for its markdown twin. Overview: https://runagain.ai/llms.txt · For agents: https://runagain.ai/for-agents.md
