{"id":50270450,"url":"https://github.com/whosydd/opencode-quota","last_synced_at":"2026-05-27T17:01:44.380Z","repository":{"id":353595019,"uuid":"1220047057","full_name":"whosydd/opencode-quota","owner":"whosydd","description":"OpenCode TUI plugin for checking quota and subscription usage across providers.","archived":false,"fork":false,"pushed_at":"2026-04-29T08:55:41.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-29T10:29:31.038Z","etag":null,"topics":["ai","github-copilot","opencode","plugin","quota","tui"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whosydd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-24T13:43:08.000Z","updated_at":"2026-04-29T08:55:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/whosydd/opencode-quota","commit_stats":null,"previous_names":["whosydd/opencode-model-usage","whosydd/opencode-model-quota","whosydd/opencode-quota"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/whosydd/opencode-quota","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fopencode-quota","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fopencode-quota/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fopencode-quota/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fopencode-quota/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whosydd","download_url":"https://codeload.github.com/whosydd/opencode-quota/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whosydd%2Fopencode-quota/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33575520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","github-copilot","opencode","plugin","quota","tui"],"created_at":"2026-05-27T17:01:41.134Z","updated_at":"2026-05-27T17:01:44.367Z","avatar_url":"https://github.com/whosydd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencode-quota\n\n\u003c!-- README-I18N:START --\u003e\n\n**English** | [中文](./README.zh.md)\n\n\u003c!-- README-I18N:END --\u003e\n\nOpenCode TUI plugin for checking model or subscription quota.\n\n## Supported Providers\n\n- **OpenCode Go** — rolling, weekly, and monthly subscription quota (via HTML scraping)\n- **GitHub Copilot** — monthly premium request quota, allowance, and overage\n- **OpenAI** — rate-limit windows derived from the current OpenAI session (for example `5h`, `7d`, and code review when available)\n\nProviders only run when their credentials are configured. Unconfigured providers are skipped silently.\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `/quota` | Fetch and show current quota from all configured providers |\n\nThe command always fetches fresh data. \n\n## Output\n\nQuota is displayed as a grouped text dialog with progress bars, percentages, and reset timers:\n\n```\n→ [OpenCode Go]\nRolling:            5m\n████████████████░░░░░░░░   67% left\nWeekly:          3d 2h\n████████████░░░░░░░░░░░░   50% left\nMonthly:          12d\n████████░░░░░░░░░░░░░░░░   33% left\n\nUpdated: Apr 27, 2:30 PM\n```\n\n## Install\n\nAdd the plugin to your `tui.json`:\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/tui.json\",\n  \"plugin\": [\"@whosydd/opencode-quota\"]\n}\n```\n\nOpenCode Go is enabled when `OPENCODE_GO_WORKSPACE_ID` and `OPENCODE_GO_AUTH_COOKIE` are set. GitHub Copilot and OpenAI are detected from your OpenCode login session.\n\n\u003cdetails\u003e\n\u003csummary\u003eManual build (for developers)\u003c/summary\u003e\n\n```bash\ngit clone https://github.com/whosydd/opencode-quota.git\ncd opencode-quota\nnpm install\nnpm run build\n```\n\nThen register it in `tui.json` using the absolute path to `dist/tui.js`.\n\u003c/details\u003e\n\n## Configuration\n\nOpenCode Go reads configuration directly from environment variables.\n\n### Environment Variables\n\n```bash\nexport OPENCODE_GO_WORKSPACE_ID=\"wrk_your_workspace_id\"\nexport OPENCODE_GO_AUTH_COOKIE=\"Fe26.2**your_auth_cookie\"\n```\n\nGitHub Copilot and OpenAI do not use plugin options or environment variables anymore. Log in through OpenCode and the plugin will reuse that OAuth session.\n\n### Getting OpenCode Go Credentials\n\n**Workspace ID:**\n\n1. Log in to [opencode.ai](https://opencode.ai) and open the Go page.\n2. The URL will look like `https://opencode.ai/workspace/wrk_xxxxxxxx/go`.\n3. The `wrk_xxxxxxxx` part is your workspace ID.\n\n**Auth Cookie:**\n\n1. Log in to [opencode.ai](https://opencode.ai) in your browser.\n2. Open Developer Tools (F12 or Ctrl+Shift+I / Cmd+Option+I).\n3. Go to **Application** → **Cookies** → `https://opencode.ai`.\n4. Find the cookie named `auth` and copy its value.\n5. The value starts with `Fe26.2**` and is a long string.\n\n\u003e The cookie expires periodically. If quota fetching fails with an auth error, repeat these steps to get a fresh cookie.\n\n### Configuration Model Details\n\nThis plugin reads OpenCode Go credentials directly from environment variables. \n\n## GitHub Copilot Data Sources\n\nThe plugin uses the Copilot quota snapshot endpoint (`/copilot_internal/user`) with the OAuth session stored by OpenCode. Auth, permission, rate-limit, and unsupported-account errors are surfaced directly.\n\n## OpenAI Data Sources\n\nThe plugin fetches from the OpenAI usage API (`/backend-api/wham/usage`) using the OAuth session stored by OpenCode. The UI labels each window from the API's reported duration instead of assuming fixed hourly or weekly names. Auth, permission, and rate-limit errors are surfaced directly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosydd%2Fopencode-quota","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhosydd%2Fopencode-quota","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhosydd%2Fopencode-quota/lists"}