Get agent model usage
get_agent_usageRequires the read scope or higher. Model usage, one row per model per UTC day: tokens_in (cache reads included, so tokens_cache_read is not added to it), tokens_out, tokens_cache_read, tokens_cache_write, cost_usd (decimal text) and cost_source: client (the tool reported its cost), estimated (LastPing priced tokens at API list prices), mixed (a traced day holds both) or empty (unknown). origin is traces or metrics; a day and model can have one of each, never summed. With id, one agent's usage; without, the project's, traces only, plus by_agent (costliest first). Both carry by_project: per project (a Claude Code session's folder) its runs, tokens and cost from traced runs only (project_scope traces_only). by_project sums each run's traced totals, while one agent's days prefer a Claude Code metrics export's reported cost, so the two need not match. With project, days become one row per UTC day with model and provider empty; project narrows days and by_project, not by_agent. untrusted_fields names the data fields LastPing did not write (job output, exporter data or user-supplied names).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Agent UUID or slug (from list_agents). Omitted: every agent in the project. | |
| range | No | Time window: 24h, 7d (the default) or 30d. It covers every UTC day that overlaps it, so 24h spans two days. | |
| project | No | Only usage from traced runs of this project; metrics-only usage has no project and is left out. days then hold one row per UTC day with model and provider empty (a run's totals are not split by model); by_agent is not narrowed. |