@thiagos1lva/opencode-token-usage-chartOpenCode TUI plugin for token usage charts
0
57
10 in 7 days
23.8
Multi-signal model
4 months ago
2026-04-08
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@thiagos1lva/opencode-token-usage-chart@0.2.9"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@thiagos1lva/opencode-token-usage-chart@0.2.9"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D @thiagos1lva/opencode-token-usage-chartopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
An OpenCode TUI plugin that adds a token usage chart view for your sessions.
Installation
npm install -g @thiagos1lva/opencode-token-usage-chart
# or
bun add -g @thiagos1lva/opencode-token-usage-chart
Usage
Add the plugin to your tui.json:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": ["@thiagos1lva/opencode-token-usage-chart"]
}
For global usage, put this in ~/.config/opencode/tui.json.
For per-project usage, put this in <repo>/tui.json.
That's it. OpenCode will load the plugin at startup.
Then open the chart with:
- Slash command:
/token-chart - Command palette value:
token.usage.chart
How It Works
- Registers a TUI route named
token-usageand a command/token-chart. - Aggregates usage from assistant messages into chart buckets (
15min,30min,hour,day,week,month). - Supports dynamic scopes:
all, optionalworkspace, and optionalsession. - Total tokens are calculated as
input + output + reasoning + cache.read + cache.write. - Includes refresh and diagnostics helpers directly in the chart view.
Requirements
- OpenCode with TUI plugin support
License
MIT