expensive
A small terminal dashboard for OpenCode spend.
expensive reads OpenCode's local SQLite database directly and turns the same
kind of accounting you get from opencode stats into a live, fast dashboard you
can keep open while you work.
What It Shows
- total cost
- total tokens
- input and output tokens
- cache read and cache write tokens
- model-level breakdown with message counts, cost, tokens, and share of spend
- daily, weekly, monthly, and all-time views
Daily usage defaults to "since 04:00" in your local timezone, which fits the usual late-night coding accounting better than a strict midnight cutoff.
Install
From this repo:
Or run without installing:
Usage
Controls:
| Key / Mouse | Action |
|---|---|
Tab |
Next time window |
Shift+Tab |
Previous time window |
| click a top tab | Jump to that time window |
r |
Refresh now |
q / Esc |
Quit |
By default, expensive refreshes every 60 seconds. The database query is cheap;
on the machine this was built on, direct SQLite aggregation was roughly two
orders of magnitude faster than parsing opencode stats.
Options
expensive finds the OpenCode database in this order:
--db <path>OPENCODE_DB_PATHopencode db path~/.local/share/opencode/opencode.db
Config
If present, config is read from:
~/.config/expensive/config.toml
Example:
= "04:00"
= 60
= "all"
Only scope = "all" is supported today.
Notes
The app uses OpenCode's stored assistant message usage fields:
costtokens.inputtokens.outputtokens.cache.readtokens.cache.writeproviderIDmodelIDvariant
That means totals should track OpenCode's own cost and token accounting without rerunning the slower stats command.
License
MIT