@arandevcode/opencode-quota-extended
v0.1.1
Published
OpenCode plugin: quota usage cards with progress bars (5h / weekly / monthly) for OpenAI, GitHub Copilot and OpenCode Go in the TUI sidebar.
Readme
@arandevcode/opencode-quota-extended
🇪🇸 Also available in Spanish
Quota usage cards for the TUI sidebar — per-window progress bars with traffic-light colors for OpenAI, GitHub Copilot, and OpenCode Go.
- Progress bar for each quota window (5h rolling, weekly, monthly, code review...)
- Shows when it resets — time remaining and exact date
- Color-coded health indication (green = ok, orange = warning, red = critical)
- OpenCode Go capable!
Heavily inspired by @slkiser/opencode-quota. Both coexist without conflict.
Install
opencode plugin @arandevcode/opencode-quota-extendedOr install from GitHub source to follow latest development:
// ~/.config/opencode/opencode.json
{
"plugin": [
"https://github.com/arandevcode/opencode-plugins/tree/main/opencode-quota-extended"
]
}CLI
View quota from the terminal without opening the TUI:
npx opencode-quota # run via npm (no install)
opencode-quota # if installed globally
node bin/quota.mjs # from the repo directory (no build needed)
npm run quota # from the repo directoryTraffic-light colors: green (ok), orange (warning), red (error).
Configuration
Optional sidecar at ~/.config/opencode/opencode-quota-extended.json:
| Field | Type | Default | Description |
|---|---|---|---|
| enabledProviders | string[] | ["openai","github-copilot","opencode-go"] | Providers to fetch |
| refreshIntervalMs | int | 60000 | Polling interval |
| cardsSidebar.order | int | 145 | Sidebar position (lower = higher) |
More Information
How it works
Registers a TUI plugin that renders a sidebar_content panel at order 145, showing quota cards for every enabled provider. Each provider fetches quota data independently from its own API.
| Provider | Windows | Auth source |
|---|---|---|
| OpenAI | 5h rolling, Weekly, Code Review | auth.json → openai / chatgpt entry |
| GitHub Copilot | Premium requests (single window) | auth.json → github-copilot entry |
| OpenCode Go | 5h, Weekly, Monthly | Config file or env vars |
Traffic-light colors: ≥50% green (accent), 25-49% yellow (warning), <25% red (error).
Authentication
Reads credentials from OpenCode's runtime auth file (~/.local/share/opencode/auth.json). Does not store, prompt for, or distribute secrets.
OpenCode Go requires additional setup — it's a bit tricky because there's no official API yet.
Create ~/.config/opencode/opencode-quota/opencode-go.json:
{
"workspaceId": "wrk_abc123...",
"authCookie": "Fe26.2..."
}| Field | Description | How to get it |
|---|---|---|
| workspaceId | Your OpenCode workspace ID | Log in at opencode.ai/go. The URL is https://opencode.ai/workspace/wrk_XXX/go — copy the wrk_XXX part. |
| authCookie | Session cookie for auth | Open DevTools (F12) → Application → Cookies → opencode.ai → find the auth cookie (starts with Fe26.2...). Or run this in the console: document.cookie.match(/(?:^\|;\s*)auth=([^;]+)/)?.[1] |
Automated setup (recommended):
npm run setupThis prompts for both values and creates the file for you. It also prints a bookmarklet you can drag to your bookmarks bar and click while on opencode.ai to extract the auth cookie with one click.
Tip: keep a browser tab logged into opencode.ai while using this plugin — the auth cookie may expire.
Relationship with @slkiser/opencode-quota
No dependency. Both plugins fetch quota independently and render their own sidebar panels. You can have one, both, or none — they do not interfere.
Troubleshooting
- Panel doesn't appear:
grep '@arandevcode/opencode-quota-extended' ~/.local/share/opencode/log/*.log - OpenCode Go shows "skipped": confirm sidecar file or env vars are set
- Old
@opentui/solidpinning bug: update to^0.4.1and clean-install (rm -rf node_modules && npm ci)
Development
npm run build # compile TS + copy TUI assets
npm run build:watch # watch mode
npm test # vitest
npm run typecheck # type-check without emittingProject structure
src/
index.ts # Plugin module (server entry)
server.ts # Server plugin (minimal, no tools)
tui.tsx # TUI plugin: sidebar_content slot
config/ # defaults, schema, loader
lib/ # types, auth, http, formatting, credential resolver
providers/ # openai.ts, copilot.ts, opencode-go.ts, registry.ts
ui/ # SidebarPanel, cards, progress-bar
tests/ # vitest unit testsLicense
MIT
