@rice-as681/opencode-quota-sidebar
v0.1.3
Published
Minimal OpenCode TUI sidebar panel showing remaining LLM quota from a Rice gateway's /llm/v1/quota endpoint.
Readme
@rice-as681/opencode-quota-sidebar
A minimal, persistent OpenCode TUI sidebar panel showing remaining LLM quota
from the Rice gateway's GET /llm/v1/quota endpoint. It's the durable
alternative to the transient-toast plugin
(@rice-as681/opencode-quota-toast, source in
../rice-quota-toast/) — an always-visible
panel instead of a per-turn toast.
It registers a Solid/OpenTUI component into the sidebar_content slot and polls
/quota on mount + every 30s + on session.idle. Key + base URL resolution
(since 0.1.3, same as the toast plugin): env RICE_LLM_API_KEY (with optional
RICE_LLM_BASE_URL), else a chat provider's options.baseURL from
~/.config/opencode/opencode.json with the key from options.apiKey when
present, else from OpenCode's /connect credential store (auth.json) — so it
works with the canonical student config, which omits apiKey on purpose.
Deliberately minimal — no collapse, compact status, multi-gateway config, or
cache layer (see @slkiser/opencode-quota for those).
Install
In tui.json (next to opencode.json, e.g. ~/.config/opencode/tui.json):
{
"$schema": "https://opencode.ai/tui.json",
"plugin": ["@rice-as681/[email protected]"]
}Restart OpenCode. The panel appears in the session sidebar. OpenCode installs the
package (and its @opentui/* + solid-js deps) from npm automatically — no
manual npm install needed.
The panel reuses the same gateway key as your chat provider, so if your
opencode.json already has a working rice-apigee provider, no extra config is
required.
Packaging note (why TUI plugins need a ./main export)
OpenCode resolves a tui.json plugin entry by loading the package's main
(.) export as a server plugin first, and only then its ./tui subexport as
the TUI layer. A package that exports only ./tui fails to resolve and
surfaces as an opaque NpmInstallFailedError — even though the package installs
fine with npm/bun directly. So this package ships a no-op { id, server }
default at . (see index.ts) plus the panel at ./tui (tui.tsx), mirroring
the shape @slkiser/opencode-quota uses. (Verified against OpenCode 1.15.x via a
local registry — the install path differs from loading a local file/tarball,
which OpenCode treats as build-from-source.)
Alternative
If you'd rather not run a TUI panel, the transient-toast plugin
@rice-as681/opencode-quota-toast toasts the same
/quota summary on session.idle. It ships pinned inside the canonical
student opencode.json, so most students already have it.
