Run
praisonai at least once so a session exists — otherwise the report is empty.Quick Start
1
See your spend
2
Change the grouping
3
Narrow the window or script it
4
See per-tool reliability
How It Works
The command reads the already-persistedtotal_tokens and cost fields on each session record in the local session store, filters by --days, groups by --by, and renders a table or JSON. No new data is written, no network calls, no configuration.
Cost values match
praisonai tracker — both read from the same pricing reference.Choosing --by
Pick the dimension that answers your question.
day sorts chronologically; model and project sort by highest token count first. tool sorts by most-called first, so your busiest (or busiest-failing) tool rises to the top.
Options
An invalid
--by value prints --by must be one of: day, model, project, tool and exits with code 1.
Per-Tool Reliability
praisonai usage --by tool reports per-tool call counts, success rate, average and last latency, and the last error — read from the local session store, same as every other grouping.
Last ms and Last error are picked by when the tool itself last ran, not by when the session was last updated. If no tool calls are recorded, the command prints No tool usage recorded yet.
The tally counts tool outcomes that reach the
AFTER_TOOL hook — which covers normalised tool failures (the common case). A raw exception that escapes the tool retry loop does not fire AFTER_TOOL and is not counted.Python: read the same data with a hook
Prefer Python? The same per-call data is available via theAFTER_TOOL hook — no new API is needed.
Output Formats
- Table
- JSON
- JSON (--by tool)
-, and a final Total row sums the report.Empty Stores and Warnings
Empty and broken reports are always distinguishable.- No sessions yet? The command prints
No usage recorded yetand exits0. - A damaged or unreadable store surfaces as
Usage may be incomplete: ...in table mode, or in the top-levelerrorsarray in JSON mode.
Best Practices
Alert on spend in CI
Alert on spend in CI
Wire
praisonai usage --days 7 --json into a cron or CI job and alert if cost exceeds a threshold.Find your most expensive model
Find your most expensive model
Run
praisonai usage --by model weekly to see which model your agents actually spend the most on.Compare workspaces
Compare workspaces
Use
praisonai usage --project <id> inside a workspace and praisonai usage --by project in the default shell to compare workloads.Spot flaky or slow tools before users notice
Spot flaky or slow tools before users notice
Run
praisonai usage --by tool --days 7 as part of your weekly review. Rows are sorted by call count first, so the busiest tool is on top — and the Success column immediately shows which ones are quietly failing. Pipe --json into jq in CI to fail a build when any tool drops below your target success rate.Script with jq
Script with jq
--json is stable for scripting — pipe into jq or a small dashboard rather than parsing the table.Related
Token Usage Protocol
Wire custom sinks and queries (databases, dashboards)
Sessions
The store
praisonai usage reads fromCost Tracker
Per-run token and cost tracking

