A terminal dashboard for OpenCode usage statistics.

oc-stats reads your local OpenCode SQLite database or JSON export files and displays token usage, cost estimates, model and provider distributions, and a 365-day activity heatmap directly in your terminal. Inspired by Claude Code's /stats command, this is an independent implementation focused on local execution, export, and shareability.
If you're already using OpenCode and want a quick view of your usage, costs, and activity trends, this tool is ready to go.
This is an unofficial community project and is not affiliated with, endorsed by, or maintained by the OpenCode team.
ratatui--jsonopencode stats and opencode stats --models for consistencyOpenCode Stats provides three data perspectives:
| Year view | Model usage | Provider usage |
|---|---|---|
![]() |
![]() |
![]() |
Each page also supports exporting a transparent-background share card directly to clipboard:

cargo install opencode-stats
After installation, run:
oc-stats
Download the archive for your platform from the Releases page, extract it, and run oc-stats directly.
The current release workflow builds for:
x86_64-pc-windows-msvcx86_64-apple-darwinaarch64-apple-darwinx86_64-unknown-linux-gnux86_64-unknown-linux-muslgit clone https://github.com/Cateds/opencode-stats.git
cd opencode-stats
cargo build --release
The compiled binary will be located at:
target/release/oc-stats
Or build directly using the git path:
cargo install --git https://github.com/Cateds/opencode-stats.git
By default, the program automatically locates your OpenCode local database and loads the data:
oc-stats
oc-stats --db /path/to/opencode.db
oc-stats --json /path/to/export.json
oc-stats --theme auto
oc-stats --theme dark
oc-stats --theme light
By default, oc-stats keeps stored costs as-is, including cost: 0, to preserve compatibility with existing behavior. If your OpenCode setup stores cost: 0 as a placeholder for responses that still have token usage, use --ignore-zero to treat those zero values as missing and estimate the cost instead.
oc-stats --ignore-zero
View the local pricing cache path:
oc-stats cache path
Update the local pricing cache:
oc-stats cache update
Clean the local pricing cache:
oc-stats cache clean
Once the program is running, you can quickly navigate pages and time ranges using the keyboard:
Tab / Left / Right / h / l — Switch pagesUp / Down / j / k — Move focus within Models / Providers pagesr — Cycle through time ranges1 / 2 / 3 — Quickly switch time rangesCtrl+S — Copy current view to clipboardq / Esc / Ctrl+C — Exit the programPages:
Overview — Overall usage summaryModels — Usage statistics by modelProviders — Usage statistics by providerTime ranges:
All timeLast 7 daysLast 30 daysoc-stats supports two input sources:
Default database locations:
%APPDATA%/opencode/opencode.db~/.local/share/opencode/opencode.db~/Library/Application Support/opencode/opencode.dbModel pricing is read from local cache first and refreshed from remote when needed:
~/.cache/oc-stats/models.jsonhttps://models.dev/api.jsonIf local overrides exist in your OpenCode configuration, they take precedence.
When complete pricing information is unavailable, the program falls back to estimated cache read/write costs. If the database already contains actual costs, those values are prioritized.
If the database stores cost: 0 for a nonzero-token response, oc-stats keeps that stored zero by default. Pass --ignore-zero to estimate the cost instead.
MIT
/stats command$ claude mcp add opencode-stats \
-- python -m otcore.mcp_server <graph>