Openrouter Costs
OpenCode TUI plugin — sidebar widget showing OpenRouter session cost and account balance
0
441
近 7 天 44
35.8
生态多维模型
14 天前
2026-09-20
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-openrouter-costs@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-openrouter-costs@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-openrouter-costsOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode TUI plugin — sidebar widget showing OpenRouter session cost and account balance.
Install
# From npm (recommended)
npx opencode-openrouter-costs
# From source (GitHub)
npx github:mhenrique94/opencode-openrouter-costs
The installer asks for your preferred language (English or Portuguese) on first run. All subsequent output — installer instructions and the widget itself — will use that language.
What it does
Adds a compact widget to the OpenCode sidebar (above "MCP Servers"):
OpenRouter
Session: $0.0523
Balance: $4.21
- Session — cost of the current session (resets on new session)
- Balance — remaining OpenRouter account credit
Requirements
- OpenCode >= 1.18.30
- OpenRouter provider configured (via
/modelsorOPENROUTER_API_KEY)
Uninstall
npx opencode-openrouter-costs --remove
Language
The widget supports English and Portuguese (BR). The language is chosen at install time
and persisted in ~/.config/opencode/openrouter-cost.json. To switch later, re-run the
installer or edit the config file directly:
{"lang": "pt"}
Valid values: "en" or "pt".
Contributing / Releasing
See RELEASING.md for the release workflow and maintenance playbook.
License
MIT
同类生态推荐
Providers Balances
opencode-providers-balances
OpenCode TUI plugin that shows provider account balances in the session sidebar. Providers are configured entirely in opencode.jsonc.
Cache Hit
opencode-cache-hit
OpenCode TUI sidebar: prompt cache hit rate, tokens & cost with sub-agent rollup. Works with opencode-visual-cache; optional per-call JSONL timeline.
Oc Usage
@taraksh011/oc-usage
OpenCode plugin — live token usage, cost, and TPS display