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

    Token Usage Footer

    v0.1.0可观测与分析
    opencode-token-usage-footer

    Responsive token usage and cache statistics footer for the OpenCode TUI

    GitHub 星标

    0

    月装机量

    140

    近 7 天 10

    综合评分SCORE

    32.4

    生态多维模型

    最近提交

    21 天前

    2026-07-29

    快速安装与配置

    opencode.json

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

    opencode.json

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

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

    English | 简体中文

    A responsive OpenCode TUI footer that shows token volume, cache hit rate, input, output, reasoning, cache usage, cost, and descendant session count.

    Requirements

    • OpenCode 1.18.5 or newer
    • OpenCode TUI

    Install

    Add the npm package to ~/.config/opencode/tui.json:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["opencode-token-usage-footer"]
    }
    

    If other TUI plugins are already configured, append this package to the existing plugin array. Restart OpenCode after changing the configuration.

    Display

    The footer adapts to terminal width:

    • Compact: total token volume and cache hit rate
    • Medium: input, output, and cost
    • Wide: reasoning, cache read/write, and session count

    Usage includes the current session and all descendant or subagent sessions. The footer refreshes after relevant OpenCode events and polls every two seconds while a session is open.

    Privacy

    The plugin only reads session statistics through the local OpenCode TUI API. It does not send data to an external service and does not require credentials.

    Development

    npm install
    npm run typecheck
    npm pack --dry-run
    

    License

    MIT