Track opencode token usage and cost in VS Code. Shows rolling-24h and today's usage in the status bar, a hover dashboard with a ring gauge / stats row / per-day chart / per-model breakdown, and one-shot warnings before you hit a configured budget (e.g. a free-tier cap that resets 5–24h after being hit).
Requires the opencode CLI on your PATH (or set opencodeTracker.opencodeBin).
Settings
| Setting | Default | Meaning |
|---|---|---|
opencodeTracker.tokenBudget |
90000000 |
Rolling-window token budget. 0 disables token warnings. |
opencodeTracker.costBudget |
0 |
Rolling-window cost budget in USD. 0 disables cost warnings. |
opencodeTracker.warnThresholds |
[0.7, 0.9] |
Fractions of the budget that trigger one-shot warnings. |
opencodeTracker.pollIntervalSec |
60 |
Refresh cadence in seconds. |
opencodeTracker.windowHours |
24 |
Rolling usage window length in hours. |
opencodeTracker.opencodeBin |
opencode |
opencode CLI executable path override. |
Development
npm install
npm run compile # tsc -> out/
npm test # vitest unit tests
npm run watch # incremental compile
Run the extension in the Extension Development Host: press F5 with the workspace open (VS Code launches a second window with the extension loaded).
Manual E2E checklist
- Status bar shows
$(flame) OC <n>/24h · <m> todayand updates within one poll interval. - Running an opencode session in the terminal increases the numbers on the next refresh.
- Hovering the status bar shows a dashboard: ring gauge with threshold ticks, stats row (24h / today / cost / sessions), 14-day chart, and model bars; colors adapt to the theme.
- With
tokenBudgetset slightly above current rolling usage andwarnThresholds: [0.7], a warning fires once per day and not repeatedly. - Renaming
opencodein PATH (or settingopencodeBinto a bad path) showsOC unavailableand a one-time info notification; restoring it recovers on the next poll. - With
pollIntervalSecchanged in settings, the refresh cadence changes without a reload.