CLI tool to analyze OpenCode usage statistics — requests, tokens, cost, broken down by time period or model.
Default — Today's summary:
Daily breakdown:
Model breakdown:
npx oc-statsOr install globally:
npm install -g oc-stats# Today's summary (default)
oc-stats
# Time period breakdown
oc-stats daily
oc-stats weekly
oc-stats monthly
oc-stats yearly
# Model breakdown
oc-stats modelsAll commands support the following flags, and they can be combined freely:
| Flag | Description | Example |
|---|---|---|
-m, --model <model> |
Filter by model | -m anthropic/claude-opus-4-6 |
--from <date> |
Start date (YYYY-MM-DD) | --from 2026-02-01 |
--to <date> |
End date (YYYY-MM-DD) | --to 2026-02-08 |
# Daily stats for a specific model
oc-stats daily -m anthropic/claude-opus-4-6
# Model breakdown for a date range
oc-stats models --from 2026-02-03 --to 2026-02-08
# Combined
oc-stats weekly -m openai/gpt-5.3-codex --from 2026-01-01 --to 2026-02-01Reads OpenCode's local storage at ~/.local/share/opencode/storage/message/.
pnpm dev # Run with tsx (no build needed)
pnpm build # Build with tsup
pnpm test # Run testsMIT


