跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    aundal

    Token Monsters

    v0.1.5可观测与分析
    @aundal/opencode-token-monsters

    OpenCode plugin that shows Token Monsters token usage breakdowns in the TUI sidebar.

    GitHub 星标

    0

    月装机量

    52

    近 7 天 14

    综合评分SCORE

    30.6

    生态多维模型

    最近提交

    5 天前

    2026-08-14

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@aundal/opencode-token-monsters@0.1.5"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    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.

    Token Monsters sidebar screenshot

    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: Total shows everything captured since the session started.
    • Session: Aktuel shows the last request only.
    • View: Prompts groups usage per prompt turn.
    • View: Tools aggregates 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