report
Calculates coding agent costs over a chosen period, breaks down spend by tool and model, and lists cheaper alternatives with finding IDs.
Instructions
What the coding agents on this machine cost over a window: the total, the split by tool and by model, and the list of findings about what would have been cheaper. Call finding with an id from the list for the full advice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| since | No | window: 7d, 30d, 90d, all, or a YYYY-MM-DD start date; default 30d | |
| source | No | restrict to one tool: "claude-code" or "codex"; default both | |
| compare | No | also return the window of the same length before this one, so the caller can say whether spend rose or fell; not allowed with since=all | |
| project | No | restrict to one project directory, exact match, or a prefix if it ends with a path separator | |
| currency | No | override the detected plan: "usd" reports as charged, "share" reports as a subscription's list-price equivalent |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| usd | Yes | total for the window; see currency | |
| plan | Yes | "api" or "subscription", re-detected on every scan | |
| prior | No | the window before this one; present only when compare was set | |
| turns | Yes | ||
| by_day | Yes | spend per calendar day in the window, by each session's start date in local time; days with no sessions are absent | |
| window | Yes | ||
| by_model | Yes | canonical model id to dollars | |
| currency | Yes | "usd" when the figures were charged, "list_price_equivalent" when a subscription covered them and the figures are what the usage would have cost on the API | |
| findings | Yes | ||
| main_usd | Yes | ||
| sessions | Yes | main sessions in the window | |
| by_source | Yes | ||
| subagents | Yes | sub-agent runs in the window | |
| scan_error | No | why the most recent scan attempt failed, in which case the figures are from the last successful scan | |
| age_seconds | Yes | seconds since that scan; the server rescans when a tool is called more than 60 seconds after the last attempt, or on refresh | |
| ingested_at | Yes | RFC 3339 time of the last successful transcript scan; empty if none has succeeded yet | |
| plan_reason | Yes | why that plan was chosen | |
| subagent_usd | Yes | ||
| skipped_files | Yes | transcript files the last scan could not parse | |
| cache_hit_rate | Yes | share of everything sent to the model that was read back from the prompt cache rather than processed afresh, 0..1 | |
| unknown_models | No | model ids with no price, with the number of turns they appeared on; those turns cost 0 here |