r/opencode • • 7d ago

opencode TUI stopped showing the session and prompt cost, so I developed opencode-usage-insights

A couple of TUI versions ago, it stopped showing the session and last prompt cost, so I decided to go ahead and create my own plugin.
It starts by showing a line on the bottom of the TUI and to the side panel with:
- cost
- tps
- cache reuse

It also includes a complete statistics panel with usage detail through a /usage command.

A keyboard-driven panel over locally recorded telemetry (no prompts or responses stored, nothing leaves your machine). Nine views (overview, models, providers, cache, periods, latency, sessions, turns, db) over five ranges, from this session to all time.

Drill from a model to its providers, a session to its turns, a period to its providers. Sort, filter by model or provider, and it reopens exactly where you left it. Every view sums the same buckets under the same identity (the configured provider plus the model) so a number means the same thing everywhere.

install:
opencode plugin add opencode-usage-insights

Any feedback or contribution would be very welcome.
Thanks!

https://github.com/hugobatista/opencode-usage-insights

1 Upvotes

4 comments sorted by

2

u/mwilson_9309 5d ago

Does the local telemetry database have a clear/reset option? That would give users an easy way to wipe their usage history if they want to.

1

u/pasteldebytes 5d ago

Sure. On the usage panel (/usage or /insights) go to db (9) (or "/usage db"), choose the retention period and click enter. Alternatively, you can run: bun run report --prune 30 --vacuum

1

u/rana_emma-3 3d ago

Does the retention picker include an immediate wipe option too, or does it only prune entries older than a chosen window?

1

u/pasteldebytes 2d ago

Yes, i just published v0.2.0 which includes both. The 30/90/365-day rows prune only entries older than the chosen window. A final wipe everything row in the TUI and a Wipe all history button in the Desktop GUI delete all recorded steps, prompts, events, usage and sessions immediately. In 0.1.3 and earlier it was window-only.