GitHub 星标
0
月装机量
57
近 7 天 10
综合评分SCORE
23.8
生态多维模型
最近提交
4 个月前
2026-04-08
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@thiagos1lva/opencode-token-usage-chart@0.2.9"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@thiagos1lva/opencode-token-usage-chart@0.2.9"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @thiagos1lva/opencode-token-usage-chartopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
README.md
查看原始文件→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-usageand a command/token-chart. - Aggregates usage from assistant messages into chart buckets (
15min,30min,hour,day,week,month). - Supports dynamic scopes:
all, optionalworkspace, and optionalsession. - 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