opencode-subagent-cost
v0.1.1
Published
Show OpenCode session cost including all subagents.
Maintainers
Readme
opencode-subagent-cost
An OpenCode TUI plugin that shows the cost of the main session and all of its transitive subagents as one total. It works around anomalyco/opencode#11027.
What it does
The plugin adds the whole session tree's cost to the right side of the OpenCode prompt. The total includes the current session, its child sessions, and any deeper descendants.
When subagents have spent money, the prompt displays:
$0.01 + $0.09 subagents = $0.10The same whole-tree total is shown while viewing a subagent, so navigating into a child session does not make the reported run cost change.
Install locally
Build the plugin:
bun install
bun run buildAdd its TUI entrypoint to the project .opencode/tui.json or global ~/.config/opencode/tui.json:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": ["file:///absolute/path/to/opencode-subagent-cost/dist/tui.js"]
}Quit and restart OpenCode after changing tui.json.
Install from npm
Install the package through OpenCode:
opencode plugin opencode-subagent-costSee the package on npm or the latest GitHub release.
The package exposes only a TUI plugin. It does not mutate stored session costs or provider billing data.
Troubleshooting
Restart OpenCode after changing tui.json or installing the plugin. If the cost is not shown, confirm that the plugin entrypoint is enabled and that the session has a non-zero cost.
Compatibility
- OpenCode 1.18.31 or newer
- The new TUI plugin API
- Bun for local development
Development
Install dependencies and run the type checks and tests:
bun install
bun run checkBuild the distributable files:
bun run buildThe package contains only dist, README.md, and LICENSE when packed for npm.
