cost command prints local token cost usage (Claude + Codex) without requiring web or CLI access. It reads token usage data from local cache files.
The
cost command is only supported for Claude and Codex providers.Usage
Options
Provider Selection
Provider identifier to query. Options:
codex- Codex token costsclaude- Claude token costsboth- Both Codex and Claudeall- All providers (will skip unsupported providers with a warning)
Output Format
Output format:
text or jsonPretty-print JSON output (only applies when
--format json)Cache Options
Force refresh by ignoring cached scans
Examples
Basic Usage
JSON Output
Force Refresh
Text Output Example
JSON Output Structure
JSON Payload Fields
Root Object
Provider identifier (
claude, codex)Always
"local" for cost commandISO 8601 timestamp of when the data was last updated
Token count for today’s session
Cost in USD for today’s session
Total token count for the last 30 days
Total cost in USD for the last 30 days
Array of daily usage entries (see Daily Entry fields below)
Aggregated totals across all days (see Totals fields below)
Error information if the cost fetch failed
Daily Entry Object
Date in
YYYY-MM-DD formatNumber of input tokens used
Number of output tokens generated
Number of tokens read from cache (Claude-specific)
Number of tokens used to create cache entries (Claude-specific)
Total tokens for the day
Total cost in USD for the day
List of model identifiers used on this day
Per-model cost breakdown (array of objects with
modelName and cost fields)Totals Object
Sum of all input tokens
Sum of all output tokens
Sum of all cache read tokens
Sum of all cache creation tokens
Sum of all tokens
Sum of all costs in USD
Notes
- Cost usage is local-only; it does not require web/CLI provider fetches
- The command reads cached token usage data from the app’s local storage
- If you query providers that don’t support cost tracking (other than Claude/Codex), they will be skipped with a warning
- Use
--refreshto force a rescan of local files instead of using cached data - Cache-specific fields like
cacheReadTokensandcacheCreationTokensare only available for Claude
