How does ccusage handle cost analysis and local data sources?
Updated
ccusage reads usage data from local sources by default and provides a cost analysis view that estimates spending based on that usage. It does not connect to external billing systems or payment platforms, so the numbers it shows are derived from locally stored CLI usage records rather than from invoices or account statements.
Where the data comes from
ccusage is described as a usage analysis tool for coding (agent) CLIs, and its documentation lists "Local Data Sources" as one of its core areas. The default behavior is to detect and view usage from all supported sources on the machine — the heading "All Sources by Default" reflects this.
What this means in practice:
- Usage records are read from where the coding CLI already stores them locally.
- No account login or cloud sync is required to see usage.
- Because the source is local, the analysis reflects what happened on that machine, not usage across other devices or accounts.
If a CLI's data is not present locally, ccusage has nothing to analyze for that source.
What the cost analysis view provides
Cost Analysis is a named view within ccusage. Its purpose is to translate recorded usage into an estimated cost, so you can see how much your coding CLI activity is costing rather than only how many tokens or requests were used.
A few things follow from how the tool is scoped:
- The cost figures are estimates computed from usage data, not billed amounts pulled from a provider.
- ccusage does not appear to integrate with payment platforms or external billing — no pricing links or payment platforms are listed in its site data.
- The exact pricing model used for the estimate is not specified in the available material, so treat the output as a usage-based approximation rather than a guaranteed invoice match.
How this fits with the other views
Cost analysis is one of several ways ccusage presents the same underlying local data:
| View | What it shows |
|---|---|
| All Sources by Default | Usage across every detected supported CLI |
| Focused Views | Usage narrowed to a specific source or dimension |
| Local Data Sources | Where the usage records are read from |
| Cost Analysis | Estimated spend derived from usage |
| Enhanced Display | Formatted presentation of the results |
Because all of these draw on the same local records, switching between them does not change the underlying data — only how it is filtered or displayed.
Practical implications
- Privacy: since analysis runs on local data, usage details stay on your machine.
- Scope: results cover only the sources detected locally; other machines or accounts are not included.
- Accuracy: cost output depends on the usage records and the pricing assumptions built into the tool, so verify against actual billing if the figure matters.
- No billing integration: ccusage is an analysis layer over usage, not a billing or payment tool.
If your goal is to understand roughly what your coding CLI usage costs based on local activity, the Cost Analysis view is the relevant one. If you need exact charges, cross-check with your provider's own billing.