@andre-barbosa/pi-opencode-go

Track your OpenCode Go subscription usage (5-hour rolling, weekly, monthly limits) in pi's footer, top right.

Packages

Package details

extension

Install @andre-barbosa/pi-opencode-go from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@andre-barbosa/pi-opencode-go
Package
@andre-barbosa/pi-opencode-go
Version
0.1.0
Published
Aug 27, 2026
Downloads
118/mo · 9/wk
Author
andre-barbosa
License
MIT
Types
extension
Size
21.5 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@andre-barbosa/pi-opencode-go

A pi package that tracks your OpenCode Go subscription usage in the top-right of pi's footer: the 5-hour rolling, weekly, and monthly limits, always visible while you work.

~/projects/foo (main)                          go 5h 96% · wk 46% · mo 33%
↑1.2k ↓305 R500 CH29.4% $0.012  45.0%/200k   (opencode-go) kimi-k3 • high

Percentages are color-coded by how much of the window you have used (green below 70%, yellow up to 90%, red above). The footer re-renders whenever a quota window changes — after every agent run, on model switches, and on a 5-minute refresh interval.

If you also use pi-codex-usage, they compose: each extension owns the footer only while a model from its own provider is selected and hands it back otherwise — so you see Codex usage on Codex models and OpenCode Go usage on opencode-go models.

Install

From npm

pi install npm:@andre-barbosa/pi-opencode-go

From git

pi install git:github.com/AndreB10/pi-opencode-go
# pinned tag:
pi install git:github.com/AndreB10/pi-opencode-go@v0.1.0

Local checkout

git clone git@github.com:AndreB10/pi-opencode-go.git
pi install ./pi-opencode-go

API key

The extension resolves your OpenCode Go API key in this order:

  1. OPENCODE_GO_API_KEY environment variable
  2. OpenCode's own auth store (~/.local/share/opencode/auth.json, the opencode-go entry) — so if you use OpenCode Go inside OpenCode, it just works, no extra setup

Usage

Source What it shows
Footer (top right) go 5h 4% · wk 54% · mo 67% — always-on, color-coded
/go command Full summary with usage bars and reset countdowns
go_usage agent tool Lets the agent check your quota when you ask ("how much of my Go quota is left?")

The footer

The extension owns the footer only while an OpenCode Go model (opencode-go provider) is selected, and restores pi's built-in footer on any other model. While active, it renders a faithful replica of the default footer with the Go usage right-aligned on the top line: cwd, git branch, session name, token stats (↑/↓/R/W, cache hit rate, cost), context %, model with thinking level, and statuses set by other extensions are all preserved. On narrow terminals the left side truncates first — the Go data stays intact.

Two default-footer details are not replicated because pi does not expose them to extensions: the (auto) compact indicator and the experimental xp badge.

How it works

Usage comes from https://opencode.ai/zen/go/v1/usage (Bearer auth) — the same endpoint OpenCode uses for its own limit display. Requests are made from your machine with your API key; nothing is sent anywhere else.

Uninstall

pi remove npm:@andre-barbosa/pi-opencode-go

Development

npm install
npm run typecheck

Test locally without installing:

pi -e ./extensions/opencode-go.ts

License

MIT