sessions
List each Claude Code or Codex run's cost, sorted by expense or time, to track spending. Includes sub-agent runs as separate rows.
Instructions
Sessions in the window with what each cost, sorted by cost or by time, most expensive or most recent first. Includes sub-agent runs as their own rows.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | "cost" for most expensive first or "time" for most recent first; default time | |
| limit | No | maximum rows to return; default 20; 0 returns every row | |
| 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 | |
| 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 |
|---|---|---|---|
| plan | Yes | "api" or "subscription", re-detected on every scan | |
| total | Yes | rows in the window before the limit | |
| 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 | |
| sessions | Yes | ||
| 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 |