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

    Token Usage Chart

    v0.2.9Observability
    @thiagos1lva/opencode-token-usage-chart

    OpenCode TUI plugin for token usage charts

    GitHub stars

    0

    Monthly installs

    57

    10 in 7 days

    Composite scoreSCORE

    23.8

    Multi-signal model

    Last commit

    4 months ago

    2026-04-08

    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": ["@thiagos1lva/opencode-token-usage-chart@0.2.9"]
    }

    opencode 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-usage and a command /token-chart.
    • Aggregates usage from assistant messages into chart buckets (15min, 30min, hour, day, week, month).
    • Supports dynamic scopes: all, optional workspace, and optional session.
    • 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