You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: desktop: show cross-session token totals and cache hit rate in the Context panel #58024
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
OpenCode Desktop 2.1.2, Windows 11 (10.0.26300), custom OpenAI-compatible provider.
What I want
The desktop Review → Context panel reports one session in isolation: messages, total tokens, input/output/reasoning tokens, cache read/write, cost, context limit and usage percentage. Two numbers that decide whether prompt caching is actually working are missing:
Total tokens used across sessions — a running total for the project, not just the current session.
Cache hit rate — cache.read / (input + cache.read), for the current session and as a rolling average.
Why
With a custom OpenAI-compatible provider, cache hits are the difference between a cheap session and an expensive one. The panel shows raw cache read/write counts but no ratio, and nothing aggregates across sessions, so there is no way to tell from the app whether caching is working.
The data already exists
GET /api/experimental/session/stats already returns the aggregate: SessionStats.Info → tokens: TokenUsage.Info { input, output, reasoning, cache: { read, write } }, cost, and a per-model models[] breakdown. This is a presentation gap in the Context panel, not a new computation.
Proposal
Add session-total and cache-hit-rate rows to the Context panel, derived from the existing usage fields.
Add an aggregate section (this project / all sessions, optional time range) fed by experimental.session.stats.
Render "not reported by provider" when cache fields are absent instead of 0.
No plugin path
Per the V2 docs only CLI/TUI plugins (@opencode/plugin/tui, OpenTUI renderables) can draw UI, and only in the terminal. The desktop app exposes no UI extension point, so this cannot be filled in by a plugin.
To restate it: in the desktop Review → Context panel you'd like a cache hit rate (cache.read / (input + cache.read)) for the current session and as a rolling average, plus token and cost totals for the project or for all sessions, built from the existing session stats endpoint. You'd also like the panel to say the provider didn't report cache data, rather than show 0, when those fields are missing. That would make it possible to tell from the app whether prompt caching works with a custom provider. The maintainers will consider it.
You're right that this can't be done as a plugin today. Desktop GUI plugin support is still in progress in #55246, which isn't merged yet.
Activity
opencode-agent commentedon Oct 22, 2026
Thanks for the detailed request, @shiluoluo16!
To restate it: in the desktop Review → Context panel you'd like a cache hit rate (
cache.read / (input + cache.read)) for the current session and as a rolling average, plus token and cost totals for the project or for all sessions, built from the existing session stats endpoint. You'd also like the panel to say the provider didn't report cache data, rather than show0, when those fields are missing. That would make it possible to tell from the app whether prompt caching works with a custom provider. The maintainers will consider it.You're right that this can't be done as a plugin today. Desktop GUI plugin support is still in progress in #55246, which isn't merged yet.
Related issues and PRs: