Skip to content
    ↑↓ select↵ openesc close
    English中文
    AlonsoSG0

    Usage Total

    v0.3.0Observability
    opencode-usage-total

    Track model usage, tokens, and costs per agent in the OpenCode TUI sidebar

    GitHub stars

    1

    Monthly installs

    128

    50 in 7 days

    Composite scoreSCORE

    35.3

    Multi-signal model

    Last commit

    8 days ago

    2026-08-11

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-usage-total@0.3.0"]
    }

    opencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    Track model usage and costs per agent in the OpenCode TUI sidebar.

    version license

    A TUI plugin for OpenCode that shows every model used by the main agent and its sub-agents, with the cost accumulated per model and a session total that includes sub-agent work.

    [!NOTE] Español: README.es.md

    Features

    • Per-agent breakdown — lists the main agent and every sub-agent with the model and accumulated cost for each
    • Tree total — the header sums the root session and all sub-agents, so you see the real session cost
    • Collapsible — toggle the section with Alt+M; the state persists across restarts
    • Session-wide accumulation — costs keep adding up for the whole session
    • Parent attribution — sub-agent models are attributed to their parent session
    • KV persistence — survives restarts and session switches

    [!WARNING] Token counts are hidden until the metric is accurate. The sidebar currently shows cost only; token data is still collected internally (in KV) and will be rendered once it can be counted reliably.

    Install

    opencode plugin -g opencode-usage-total
    

    The command registers both the server and the TUI sidebar entry in your global config. Restart opencode afterwards.

    Update

    rm -rf ~/.cache/opencode/packages/opencode-usage-total@latest
    opencode plugin -g opencode-usage-total
    

    Usage

    Start a session in OpenCode and open the sidebar: the 🧠 Models section lists every model used in the current session, with the accumulated cost per model and a total that includes sub-agent work.

    Press Alt+M to collapse or expand the list.

    sidebar

    Requirements

    • OpenCode with TUI support (plugin API ≥ 1.14.50)

    Development

    npm install
    npm run build   # bundle with tsup
    npm test        # run the vitest suite
    

    MIT