You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9855b0d
Browse filesBrowse the repository at this point in the historyBrowse files
Display the OpenCode Go plan's rolling 5h, weekly, and monthly usage
windows in the footer and /quota output for the active opencode-go model.
Usage comes from GET https://opencode.ai/zen/go/v1/usage using the active
provider credential (or $OPENCODE_API_KEY). The endpoint is unofficial
(anomalyco/opencode#31084 was closed without an official API) and reports
only percentages, so the adapter is best effort and keeps the last good
snapshot on failure.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,15 @@ A [pi](https://pi.dev) extension that displays quota for the **currently selecte
9
9
| Z.ai (`zai`) | Coding-plan quota windows | Pi provider auth, or `$ZAI_API_KEY` / `$Z_AI_API_KEY`| Unofficial usage endpoint |
10
10
| OpenAI Codex (`openai-codex`) | Rate-limit windows and reset countdowns | Pi ChatGPT OAuth / subscription auth | Private ChatGPT backend endpoint |
11
11
| GitHub Copilot (`github-copilot`) | Monthly premium interactions quota | Pi GitHub Copilot auth | Undocumented endpoint; best effort |
12
+
| OpenCode Go (`opencode-go`) | Rolling 5h / weekly / monthly plan windows | Pi `opencode-go` auth, or `$OPENCODE_API_KEY`| Unofficial workspace usage endpoint |
12
13
13
14
Codex usage is only shown for `openai-codex` OAuth/subscription auth. An OpenAI API key uses a different billing system and is not represented as a Codex subscription quota. Codex window labels come from their reported durations, not assumed primary/secondary positions.
14
15
15
16
The GitHub Copilot adapter uses `GET https://api.github.com/copilot_internal/user`. This endpoint is undocumented and may change. Pi's resolved Copilot API token is not accepted by this endpoint, so the adapter reads the original GitHub OAuth token from the active Pi `auth.json` entry (using Pi's configured agent directory) and sends it only to GitHub's API host. It is never logged or persisted by this extension. The adapter is best effort and retains the last successful display if a later refresh fails.
16
17
17
18
## Display and commands
18
19
19
-
- Footer examples: `Codex 5h 16% (3h) · 1w 3% (6d 22h)` and `GitHub Copilot 1mo 54% (12d)`. The Copilot display omits chat and code-completion quotas.
20
+
- Footer examples: `Codex 5h 16% (3h) · 1w 3% (6d 22h)`, `GitHub Copilot 1mo 54% (12d)`, and `OpenCode Go 5h 1% (2h) · 1w 0% (6d) · 1mo 0% (30d)`. The Copilot display omits chat and code-completion quotas.
20
21
- Percentages are usage percentages, colored warning at ≥70% and error at ≥90%; reset countdowns are dim.
21
22
- The built-in footer is preserved; quota text is right-aligned on its last line, or given its own line if needed.
22
23
- Refreshes on session start, provider/model switch, after each turn (throttled), and every 5 minutes while quota data is available. Responses are cached for 60 seconds.
@@ -39,6 +40,7 @@ Shared results and the `QuotaProvider` contract live in `quota-types.ts`; common
39
40
- Z.ai calls `GET https://api.z.ai/api/monitor/usage/quota/limit` using the active provider's credential (or the Z.ai environment fallback).
40
41
- Codex calls `GET https://chatgpt.com/backend-api/wham/usage` with the OAuth bearer token and `ChatGPT-Account-Id` extracted from the token claims. This is a private backend endpoint, not a documented OpenAI API.
41
42
- GitHub Copilot calls `GET https://api.github.com/copilot_internal/user` with the original OAuth token from Pi's active `github-copilot` auth entry. It displays only `quota_snapshots.premium_interactions`, labeled `1mo` to identify its monthly window.
43
+
- OpenCode Go calls `GET https://opencode.ai/zen/go/v1/usage` with the active `opencode-go` credential. The endpoint reports only usage percentages for `rolling` (5h), `weekly`, and `monthly` windows, so each sample is shown as a percent against an implicit 100. It is an unofficial workspace endpoint (no public API exists; see `anomalyco/opencode#31084`), so the adapter is best effort and keeps the last successful display on failure.
42
44
43
45
No provider credential is copied or persisted by this extension. It asks Pi's model registry for active-provider auth and, for the GitHub Copilot endpoint only, reads the existing OAuth token from the auth file Pi uses for the active agent directory.
0 commit comments