Tokenuze is a CLI tool that summarizes token and cost usage from various LLM providers. It scans session logs, aggregates token counts, and reports pricing. The output is a table or JSON, suitable for dashboards.
- Zig 0.16.0-dev.1456+16fc083f2 or newer (if building from source)
sqlite3in yourPATH(for Zed and Crush providers)- Network access to fetch remote pricing / uploading stats (optional)
- Amp
- Claude Code
- Codex CLI
- Crush: project-based, recursively crawled
- Gemini CLI
- Opencode
- Zed
- Prebuilt binaries: grab the latest release from the Releases page and put
tokenuzeon yourPATH. - Build from source: requires Zig 0.16.0-dev.1456+16fc083f2 or newer
git clone https://github.com/bfactory-ai/tokenuze.git
cd tokenuze
zig build -Doptimize=ReleaseFast # binary will be in zig-out/bin/By default it will display daily usage across all providers since the beginning of time:
tokenuzeYou can restrict what tokenuze displays by filtering by date
tokenuze --since 20250101 --until 20250107Or requesting specific providers
tokenuze --agent claude --agent codexAnd combine everything
tokenuze --agent claude --agent codex --since 20250101 --until 20250107
By appending the --sessions flag you can display session usage instead of daily.
Using the --json flag will display the result as a JSON file, which can be pretty printed with --pretty.
If you are tracking the stats in a separate server you can append the --upload flag to send them there.
Finally, you can see all this information typing tokenuze --help.
Details
{
"daily": [
{
"date": "Nov 25, 2025",
"isoDate": "2025-11-25",
"inputTokens": 248291670,
"cachedInputTokens": 236782489,
"outputTokens": 1188464,
"reasoningOutputTokens": 749903,
"totalTokens": 249489543,
"costUSD": 55.88007429999999,
"models": {
"gemini-2.5-flash": {
"inputTokens": 10992,
"cachedInputTokens": 0,
"outputTokens": 10,
"reasoningOutputTokens": 79,
"totalTokens": 11032,
"costUSD": 0.0033225999999999998,
"pricingAvailable": true,
"isFallback": false
},
"gemini-3-pro-preview": {
"inputTokens": 5664,
"cachedInputTokens": 10521,
"outputTokens": 1738,
"reasoningOutputTokens": 2048,
"totalTokens": 16781,
"costUSD": 0.0342882,
"pricingAvailable": true,
"isFallback": false
},
"gpt-5.1-codex": {
"inputTokens": 248275014,
"cachedInputTokens": 236771968,
"outputTokens": 1186716,
"reasoningOutputTokens": 747776,
"totalTokens": 249461730,
"costUSD": 55.842463499999994,
"pricingAvailable": true,
"isFallback": false
}
},
"missingPricing": []
}
],
"totals": {
"inputTokens": 248291670,
"cachedInputTokens": 236782489,
"outputTokens": 1188464,
"reasoningOutputTokens": 749903,
"totalTokens": 249489543,
"costUSD": 55.88007429999999,
"missingPricing": []
}
}Missing pricing entries are listed under missingPricing.
To add a new provider:
- Create a new file in
src/providers/and use theprovider.makeProviderfactory. - Implement a parser for the provider's log format that emits
model.TokenUsageEventobjects. - Use helpers in
src/providers/provider.zigfor common tasks like JSON parsing and timestamp handling. - Register the provider in
src/root.zigand expose aloadPricingDatafunction for fallback pricing. - Add test fixtures in a new
fixtures/<provider>directory and write unit tests in your provider's file.