Go Limits
OpenCode TUI sidebar widget: opencode Go subscription usage limits (session/weekly/monthly) as bars + percentages
0
908
近 7 天 17
37.9
生态多维模型
12 天前
2026-10-08
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-go-limits@0.2.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-go-limits@0.2.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-go-limitsOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
An OpenCode TUI plugin that shows your opencode Go subscription usage limits in the sidebar — session, weekly, and monthly windows as bars with percentage and reset countdown.
Usage
Session ██████████ 100% 2h 3m
Weekly ████░░░░░░ 40% 4d 5h
Monthly ██░░░░░░░░ 20% 15d 3h
- Session — the 5-hour rolling window (
Xh Xmuntil reset) - Weekly —
Xd Xhuntil reset - Monthly —
Xd Xhuntil reset
Bar color goes green → yellow (70%+) → red (90%+ or rate-limited). Data refreshes every 30 seconds.
Requirements
- OpenCode v1 (≥ 1.3.4) or v2 (≥ 2.0.x). The package declares
engines.opencode: "^1.3.4 || ^2.0.0"— v1 hosts before 1.3.4 lack the runtime-module interception the plugin relies on, so they are not supported. The same install works on both versions: the plugin ships a dual-shape entry module that each loader reads its own way. - An active opencode Go subscription with
opencodeauth set up (opencode auth loginor/connectin the TUI) — the key is read fromauth.jsonunder theopencode-goprovider, from the first of:$OPENCODE_DATA_DIR$XDG_DATA_HOME/opencode~/.local/share/opencode
Tested against: @opencode-ai/plugin@1.18.35 (v1) and @opencode/plugin@2.0.24 (v2) types.
Install
opencode v1:
opencode plugin opencode-go-limits -g
opencode v2:
opencode plugin add opencode-go-limits
or add it manually to ~/.config/opencode/tui.json:
{
"plugin": ["opencode-go-limits"]
}
Restart OpenCode after installing. The widget appears in the sidebar below the built-in blocks (context, MCP, LSP, todos, files).
How it works
The plugin calls the (undocumented) Go usage endpoint:
GET https://opencode.ai/zen/go/v1/usage
Authorization: Bearer <api-key>
which returns the percentage used and reset time for each window:
{
"usage": {
"rolling": { "status": "ok", "percent": 98, "resetsAt": "2026-10-07T22:03:52.000Z" },
"weekly": { "status": "ok", "percent": 39, "resetsAt": "2026-10-12T00:00:00.000Z" },
"monthly": { "status": "ok", "percent": 19, "resetsAt": "2026-10-22T18:11:46.000Z" }
}
}
The API key is read from auth.json on every fetch, so rotating your key doesn't require a restart. If the fetch fails, a warning with the HTTP status is logged and the widget keeps its last known data; with no key configured, only the header is shown.
Files
| File | Purpose |
|---|---|
v1.tsx |
OpenCode v1 TUI plugin source: registers the sidebar_content slot and renders the bars |
v2.tsx |
OpenCode v2 port: same widget via the v2 setup/slot API (nested theme tokens) |
entry.ts |
Dual-shape entry module (id + tui + setup) — what opencode loads from dist/tui.js |
shared.ts |
Rendering helpers shared by both implementations (bar, reset countdown) |
usage.ts |
Fetch + parse of the usage endpoint (no dependencies) |
build.mjs |
Compiles the sources to dist/ with the Babel solid preset |
dist/ |
Compiled output — what npm ships and opencode loads |
License
MIT
同类生态推荐
Tui Quota Usage
opencode-tui-quota-usage
OpenCode quota usage sidebar tracker for OpenCode V2 CLI/TUI
Usage Limits
opencode-usage-limits
Show OpenCode Go and ClinePass subscription usage (5-hour / weekly / monthly) in the OpenCode TUI sidebar.
Go Meter
opencode-go-meter
Your session context usage and OpenCode Go plan windows in the opencode v2 TUI sidebar, with a forecast of where the current pace lands by each reset.