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
Add a /usage slash command (alias /cost) producing a dedicated report of session token consumption and financial cost.
Why
Today cost/token info is only a compact inline line in the sidebar footer (packages/tui/src/feature-plugins/sidebar/context.tsx). A dedicated report would give per-message and cumulative accounting.
Proposed behavior
/usage opens a report: per-message tokens (input/output/reasoning/cache), cumulative totals, and estimated cost { amount, currency } (data already tracked, see packages/opencode/src/acp/usage.ts).
Showables: per session, per day, or since a date; exportable as markdown.
Optionally aggregate across all providers used.
Benefits
Financial/cost visibility (LLM spend) without external tooling.
Analogous to /cost in other CLIs; complements /context for window size vs /usage for spend.
This issue might be a duplicate of existing issues. Please check:
[FEATURE]: Display token usage information in the TUI #13003: Open feature request for displaying token usage in the TUI, including a proposed /usage or /tokens slash command with per-message breakdown and cost estimation — very similar scope.
I would like to contribute a native TUI version of this, rather than a plugin. A useful first slice would be a compact daily usage block in the existing session sidebar, complementing the native current-session line:
It would be pretty useful if this command were added. In addition to pay-as-you-go providers, subscription-based ones should also be supported. I use kimi-code and antigravity-cli from time to time alongside opencode, and their usage report information is much easier to check. Especially when using OpenCode Go or other subscriptions connected to OpenCode, it becomes too annoying to check the 5-hour or weekly limits from the browser.
I have actually created a small plugin to add this usage information to the TUI and the /usage command, but it currently only shows Kimi.ai and OpenCode Go usage details since I don't have any other subscriptions. (Feel free to send PRs to my plugin if you have other AI providers or pay-as-you-go formats.) https://github.com/kaanchinar/opencode-usage-report
Thanks for the detailed request, @afonsoft! You're asking for a dedicated report of a session's spend: tokens per message (input/output/reasoning/cache), running totals and cost, viewable per session, per day or since a date, and exportable as markdown. Maintainers will consider it.
A few notes on what v2 already has:
/usage is already a built-in command in v2. It opens the OpenCode Console usage-limits dialog, so a built-in report would probably need a different name, such as /cost.
/stats and opencode stats --days N --cost (or --full) already give totals with an input/output/reasoning/cache breakdown over a time range.
Until then, a small TUI plugin can give you the per-message session report now. It adds a /cost command (also in the command palette). The command lists every assistant message in the current session and its subagents, with tokens and cost, plus a total. Press ctrl+e in the dialog to write the report as usage-<sessionID>.md in the project directory. It type-checks against the current plugin API, but I haven't tested it in a live TUI.
Save it as ~/.config/opencode/plugins/cost/tui.ts. OpenCode discovers plugins there automatically, so restart the TUI after saving.
Activity
github-actions commentedon Aug 12, 2026
This issue might be a duplicate of existing issues. Please check:
/usageor/tokensslash command with per-message breakdown and cost estimation — very similar scope.\usagecommand in OpenCode CLI #29634: Closed feature request for a\usagecommand in the CLI showing token usage, estimated cost, and usage by model — nearly identical proposal./statsslash command covering token summaries and cost estimates per session.Please review these issues to see if your request has already been addressed or is being tracked elsewhere.
Oloompa commentedon Aug 15, 2026
It would be nice to also have reports in native application in order to be able to compare periods usage and analyse impact of configuration decisions
tekram commentedon Aug 28, 2026
I would like to contribute a native TUI version of this, rather than a plugin. A useful first slice would be a compact daily usage block in the existing session sidebar, complementing the native current-session line:
Requirements:
I have a working local prototype and can prepare a focused PR with aggregation tests and TUI coverage.
kaanchinar commentedon Sep 23, 2026
It would be pretty useful if this command were added. In addition to pay-as-you-go providers, subscription-based ones should also be supported. I use kimi-code and antigravity-cli from time to time alongside opencode, and their usage report information is much easier to check. Especially when using OpenCode Go or other subscriptions connected to OpenCode, it becomes too annoying to check the 5-hour or weekly limits from the browser.
I have actually created a small plugin to add this usage information to the TUI and the /usage command, but it currently only shows Kimi.ai and OpenCode Go usage details since I don't have any other subscriptions. (Feel free to send PRs to my plugin if you have other AI providers or pay-as-you-go formats.) https://github.com/kaanchinar/opencode-usage-report
opencodejr commentedon Oct 28, 2026
Thanks for the detailed request, @afonsoft! You're asking for a dedicated report of a session's spend: tokens per message (input/output/reasoning/cache), running totals and cost, viewable per session, per day or since a date, and exportable as markdown. Maintainers will consider it.
A few notes on what v2 already has:
/usageis already a built-in command in v2. It opens the OpenCode Console usage-limits dialog, so a built-in report would probably need a different name, such as/cost./statsandopencode stats --days N --cost(or--full) already give totals with an input/output/reasoning/cache breakdown over a time range.Until then, a small TUI plugin can give you the per-message session report now. It adds a
/costcommand (also in the command palette). The command lists every assistant message in the current session and its subagents, with tokens and cost, plus a total. Pressctrl+ein the dialog to write the report asusage-<sessionID>.mdin the project directory. It type-checks against the current plugin API, but I haven't tested it in a live TUI.Save it as
~/.config/opencode/plugins/cost/tui.ts. OpenCode discovers plugins there automatically, so restart the TUI after saving.Costs are whatever the provider reports, so providers that report $0 will show $0 here too.
Related issues:
debug.turn_tokensviewopencode stats --days Nbreakdown