🧩Claude Agent SDK Cost Tracking
Also known as Agent SDK Cost Tracking, Agent SDK cost, modelUsage
Reading what an agent run cost, from the messages it sends back.
Think of it like
It is like a shop till that adds up your basket. The bank still has the real bill.
Example
A team logs total_cost_usd for each run. They see one kind of task costs ten times more, and give it a smaller model.
Why it matters
Agents can spend a lot without anyone noticing. Tracking it per run shows where the money goes.
Definition
Common mistake
Key takeaways
- 1Total on the result. total_cost_usd.
- 2Count each ID once. Parallel calls share one.
- 3An estimate. Not the bill.