tokenuze
Tokenuze
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.
Requirements
- Zig 0.16.0-dev.2535+b5bd49460 or newer (if building from source)
sqlite3in yourPATH(for Zed, Crush, and Opencode providers)- Network access to fetch remote pricing / uploading stats (optional)
Supported Providers
Installation
- Prebuilt binaries: grab the latest release from the Releases page and put
tokenuzeon yourPATH. - Build from source: requires Zig 0.16.0-dev.2535+b5bd49460 or newer
git clone https://github.com/bfactory-ai/tokenuze.git
cd tokenuze
zig build -Doptimize=ReleaseFast # binary will be in zig-out/bin/
Quick Start
By default it will display daily usage across all providers since the beginning of time:
tokenuze
Options
You can restrict what tokenuze displays by filtering by date
tokenuze --since 20250101 --until 20250107
Or requesting specific providers
tokenuze --agent claude --agent codex
And combine everything
tokenuze --agent claude --agent codex --since 20250101 --until 20250107
Use the -r or --recursive flag to enable recursive searching (supported by providers like Crush):
tokenuze --agent crush --recursive
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.
JSON Output Sample
Extending
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.