Repository navigation
Releases
Releases · jashjacob/opencode-token-metrics
v0.3.0
opencode-token-metrics v0.3.0
One package for OpenCode V1 and V2.
V2
- The same package loads in the OpenCode 2 TUI and renders in the prompt footer.
- Add
"opencode-token-metrics"topluginsinopencode.json. Options go in~/.config/opencode/cli.json. - A tool loop keeps one graph across steps, then freezes on the execution's summed tokens.
- Compaction is its own generation and does not leak the previous turn's totals.
V1
Install is unchanged:
opencode plugin opencode-token-metrics -gThe server entry now loads as an empty hook, so that installer does not error on startup.
Metrics
- Prompt-cache hit rate on the frozen line (
cache 87%). It is omitted when the provider reports no prompt tokens.showCachedefaults totrue.
Verification
- 118 tests, typecheck, and the packed-package smoke test.
- CI passed on Node 20 and 22.
v0.2.0
opencode-token-metrics v0.2.0
Install: opencode plugin opencode-token-metrics -g
Metrics
- Average is now active generation speed — sums only the spans where tokens were actually streaming, so tool calls no longer drag it down.
- Exact-total scaling — on completion the frozen graph, peak bucket, and peak rate are rescaled to the provider's reported token count.
Graph
- Fragmentation-invariant counting — token totals are independent of how the stream is chunked.
- Low columns render as short bars instead of blanks (no phantom gaps).
- Stable scaling to the turn's busiest second (no rescale when the peak scrolls out of view).
- The graph stays continuous across tool calls and pauses.
Verification
- 78 unit/integration tests, typecheck, packed-package smoke test, and pack dry-run.
- CI on Node 20 and 22;
npm run ciruns the same checks locally.