Openrouter Costs
OpenCode TUI plugin — sidebar widget showing OpenRouter session cost and account balance
0
441
44 in 7 days
35.8
Multi-signal model
14 days ago
2026-09-20
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-openrouter-costs@0.1.1"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-openrouter-costs@0.1.1"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-openrouter-costsOpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
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
Similar plugins
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