opencode-plugin-statusbar
v0.1.0
Published
Reactive token & cost status bar for the OpenCode TUI
Maintainers
Readme
opencode-plugin-statusbar
A reactive token & cost status bar for the OpenCode TUI.
While you work, it shows live per-session totals for input/output/reasoning tokens, cache reads/writes, and the accumulated cost — right-aligned in the bottom status bar.
in 12.3k out 4.5k r 1.1k cache 8.2k/1.0k $0.42Features
- Reactive — updates as messages stream in; no polling.
- Session-scoped — appears only inside a session and reflects that session's usage.
- Full token breakdown — input, output, reasoning, cache read/write (when present).
- Cost aware — sums
costreported per assistant message. - Themed — uses the active OpenCode theme's muted/text colors.
- Graceful — hides reasoning/cache segments when there is no data and renders
$0when cost is unavailable.
Requirements
- OpenCode
1.10+with TUI plugin support - Any OpenCode model provider (the plugin reads usage data the TUI already exposes)
Installation
Add the plugin to your OpenCode config. In opencode.json (project or global):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-plugin-statusbar"]
}Then restart OpenCode (opencode), open or start a session, and look at the bottom bar.
Local / git install
{
"plugin": ["github:yuseferi/opencode-statusbar"]
}Configuration
No configuration required — it works out of the box. The plugin id is statusbar.tokens,
so you can disable it per-project with the standard plugin_enabled setting if you ever want to:
{
"plugin_enabled": {
"statusbar.tokens": false
}
}How it works
The plugin is a TUI plugin registered into the
app_bottom slot. It observes the active route via api.route.current and, inside a
session, sums token counters and cost across the session's assistant messages using
api.state.session.messages(sessionID). Both the route and the message store are reactive
Solid signals, so the bar updates automatically as new messages arrive — no timers, no server.
solid-js and @opentui/solid are injected by the OpenCode runtime and are declared as
optional peer dependencies (not bundled).
Development
Requires Node.js ≥ 20 (or Bun ≥ 1.0).
git clone https://github.com/yuseferi/opencode-statusbar.git
cd opencode-statusbar
npm install
npm run typecheckTo test locally against your OpenCode:
# in this repo
npm link
# in your OpenCode workspace
npm link opencode-plugin-statusbar
# add "opencode-plugin-statusbar" to opencode.json plugins, then restart opencodeScreenshot
TODO: add a terminal capture showing the status bar in a live session.
License
MIT — see LICENSE.
