Add oc-go-usage-display plugin - #690
Open
christophkroeppl wants to merge 5 commits into
Open
christophkroeppl wants to merge 5 commits into
christophkroeppl wants to merge 5 commits into
Conversation
christophkroeppl
marked this pull request as ready for review
September 9, 2026 11:06
- min_version 1.4.3 -> 1.18.0 (package.json engines: opencode ^1.18.0) - description: cover both hosts, the per-model Go-token mix, toggles and the host-scoped auth vars (the old text still advertised the removed unscoped OPENCODE_GO_* spelling) - installation: verified install commands; project-local npm needs --legacy-peer-deps because of the exact-pinned optional UI peers - add kilocode/quota tags
2.0.1 loosens the exact-pinned optional UI peers to caret ranges, so a plain `npm install oc-go-usage-display@latest` resolves cleanly again (npm 10.8.2). Drop the --legacy-peer-deps workaround and the ERESOLVE caveat, and lead with the project-local npm install.
Match the upstream README: commands are unversioned so none of them goes stale after a release. An unversioned plugin spec still resolves.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds oc-go-usage-display — live OpenCode Go subscription usage (5h / 7d / 30d windows) for opencode and the Kilo Code CLI. Zero popups, no context injection, and the plan is read from the credential store the host already uses.
What you get
Go Usagesidebar5h/7d/30d, the next reset on its own line (5h resets in 2h5m), plus a foldable per-model mixsession_prompt_rightline, e.g.Go 5h 42% | 7d 15%go_usagetoolGo 5h 42% (reset 3h12m) | 7d 15% | 30d 61%)Details that matter:
Contextpanel measures the number next to it. It is a share of tokens, never a share of the plan or a price, because the plan's absolute limits are not client-visible.integrated(default) takes over the host's ownToken Usageband and draws the Go plan once inside anOpenCode Gogroup;standaloneputs the block in its own band and leaves the host panel alone. Switch withGo usage: toggle sidebar mode.Go usage: toggle sidebarandGo usage: toggle statuslinein the command palette, persisted per surface; also settable astui.jsonplugin options orOPENCODE_OC_GO_*/KILO_OC_GO_*env vars.Requirements
@kilocode/cli, binarieskilo/kilocode) for the Kilo targetInstall
Install (npm, project-local — recommended)
Install (global npm — nothing added to your project)
Note the bare command:
npxlooks in the registry, not at globally installed bins, sonpx oc-go-usage-display-initwon't find it.Install (Bun, project-local)
One-shot (nothing added to your project)
Project scope (
.opencode/instead of~/.config/opencode)No files copied — let the host resolve the package
This resolves the package at startup instead of copying it, so pin the version if you want reproducible installs.
Kilo Code CLI
Kilo's
tui.jsonrejects thesidebar/statuslineoptions (both surfaces are on by default there), so its entry is a plain plugin spec. Toggle surfaces via the command palette orKILO_OC_GO_*— a Kilo bundle only ever readsKILO_OC_GO_*, so anOPENCODE_OC_GO_*name can never steer it.From a checkout
Auth
First match wins; secrets are never logged. Each host reads only its own credential store, so a Kilo login never feeds the opencode plugin or vice versa.
OPENCODE_OC_GO_MOCK=1/KILO_OC_GO_MOCK=1— deterministic mock snapshot (testing)OPENCODE_OC_GO_API_KEY/KILO_OC_GO_API_KEY—Authorization: BeareragainstGET https://opencode.ai/zen/go/v1/usageauth.json— same Bearer path,opencode-gokey elseopencode, read from that host's own store (~/.local/share/opencode/auth.json,~/.config/kilo/auth.json), so just signing in through theopencode-goprovider is enough — nothing to pasteworkspaceId+authCookie— env vars oroc-go-usage-display.jsonin the host's config dir, scrapinghttps://opencode.ai/workspace/{workspaceId}/goGo n/a (…)Successful snapshots are cached for 60s (memory +
oc-go-usage-display-cache.jsonin the host's config dir); failures are never cached, and the usage endpoint is the only network call. The old unscopedOPENCODE_GO_*spelling was removed in 2.0 — if you configured credentials with it, move them to the host-scoped name of the host you actually run.Verify / uninstall
Entry:
data/plugins/oc-go-usage-display.yaml— screenshots of both hosts' sidebars and the full feature/flag reference are in the README.