@aundal/opencode-token-monstersOpenCode plugin that shows Token Monsters token usage breakdowns in the TUI sidebar.
0
52
14 in 7 days
30.6
Multi-signal model
5 days ago
2026-08-14
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": ["@aundal/opencode-token-monsters@0.1.5"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@aundal/opencode-token-monsters@0.1.5"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D @aundal/opencode-token-monstersopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
Token Monsters adds a token usage sidebar to OpenCode. It shows the current context size, cache hit percentage, session totals, current prompt totals, prompt/tool/file breakdowns, and tool-definition overhead.
All numbers are approximate and counted with gpt-tokenizer using the OpenAI o200k tokenizer. For Claude, Copilot, and other non-OpenAI models, treat the numbers as a ballpark.
Install
Add the plugin to both OpenCode config files.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": [
"@aundal/opencode-token-monsters@latest"
]
}
Restart OpenCode after saving. OpenCode installs npm plugins automatically at startup.
~/.config/opencode/tui.json
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
"@aundal/opencode-token-monsters@latest"
]
}
Install with OpenCode
Paste this prompt into OpenCode:
Install the OpenCode plugin @aundal/opencode-token-monsters@latest into my global opencode.json and tui.json plugin arrays. Preserve my existing config, validate config shapes against https://opencode.ai/config.json and https://opencode.ai/tui.json, and tell me to restart OpenCode when done.
Usage
Token Monsters appears in the session sidebar.
Use /tokenmonster to fold or unfold the sidebar panel.
You can also click the Token Monsters header to fold or unfold it with the mouse.
Views
Session: Totalshows everything captured since the session started.Session: Aktuelshows the last request only.View: Promptsgroups usage per prompt turn.View: Toolsaggregates tool and file usage.
Package
The package exports one OpenCode plugin module with both server and TUI hooks. The server hook writes token capture data, and the TUI hook renders the sidebar.
End users only install the npm package in opencode.json and tui.json. No build step is needed for end users. The published package ships the compiled files.
Development
bun install
bun run build
npm pack
Publish
bun run build
npm pack
npm publish --access public
License
MIT