openuse is a small CLI that reads your local OpenCode SQLite history, matches models against the OpenRouter model catalog, and prints a readable usage + cost report.
- Reads usage rows from your OpenCode database (
part+messagetables). - Fetches live model pricing from
https://openrouter.ai/api/v1/models. - Matches local model names to OpenRouter model IDs with fuzzy matching.
- Calculates estimated USD cost per model per day.
Use it directly from npm (no cloning/building needed):
npx openuseOr install globally:
npm i -g openuse
openuseRun with default database path:
npx openuseYou can also pass your database file as the first CLI argument, or set OPENCODE_DB_PATH.
Default DB path if no argument/env is provided:
~/.local/share/opencode/opencode.db
The CLI prints three tables:
Daily Usage/Model: token usage and estimated cost by date + model.Daily Usage/Provider: token usage and estimated cost by date + provider.Daily Total Usage: models used, token totals, and total cost by date.
- Node.js 18+
- Access to your OpenCode SQLite database
- Network access to OpenRouter models endpoint