@narumitw/pi-usage 0.51.0 β 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/index.ts +2613 -0
- package/dist/index.ts.map +7 -0
- package/package.json +17 -11
- package/src/format.ts +20 -0
- package/src/index.ts +1 -0
- package/src/providers/opencode-zen.ts +83 -0
- package/src/query.ts +24 -0
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -40,6 +40,10 @@ Try this package locally from the repository root:
|
|
|
40
40
|
pi -e ./packages/pi-usage
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
+
The package declares `dist/index.ts`, so an unbuilt local checkout must run `npm --workspace @narumitw/pi-usage run build` before Pi loads the package directory.
|
|
44
|
+
|
|
45
|
+
`just try usage` runs that build automatically.
|
|
46
|
+
|
|
43
47
|
## π Usage
|
|
44
48
|
|
|
45
49
|
Run:
|
|
@@ -134,6 +138,16 @@ GitHub's quota endpoint requires the original GitHub OAuth token rather than the
|
|
|
134
138
|
|
|
135
139
|
The extension does not call OpenRouter's account-level `/credits` endpoint because that operation requires a separate management key. OpenRouter documents the distinction between credit and rate limits in its [API limits guide](https://openrouter.ai/docs/api_reference/limits).
|
|
136
140
|
|
|
141
|
+
### OpenCode Go (Zen)
|
|
142
|
+
|
|
143
|
+
- Provider ID: `opencode-go`
|
|
144
|
+
- Semantics: OpenCode Zen plan usage windowsβrolling, weekly, and monthly
|
|
145
|
+
- Source: `GET {model base URL}/usage` on the configured `opencode.ai` gateway using Pi's resolved inference API key
|
|
146
|
+
- Displayed data: used percentage and reset time for each window; `rate-limited` windows remain visible at their reported usage, while unknown statuses are reported as unavailable notes
|
|
147
|
+
- Statusline examples: `zen 0% r 4% w 2% m`
|
|
148
|
+
|
|
149
|
+
The usage endpoint is derived from the model's base URL (`β¦/zen/go/v1/usage`) and is only queried when the resolved origin is `https://opencode.ai`; other origins fail before sending the credential.
|
|
150
|
+
|
|
137
151
|
## π§ Current and configured accounts
|
|
138
152
|
|
|
139
153
|
`Current` means the provider and credential used by Pi's selected model. `Configured` means Pi reports runtime auth for another supported provider; it does not mean that provider is active.
|
|
@@ -181,6 +195,9 @@ Behavior changes:
|
|
|
181
195
|
|
|
182
196
|
```txt
|
|
183
197
|
packages/pi-usage/
|
|
198
|
+
βββ dist/ # Generated TypeScript runtime loaded by Jiti
|
|
199
|
+
βββ scripts/
|
|
200
|
+
β βββ build-runtime.mjs # Deterministic runtime builder and boundary validator
|
|
184
201
|
βββ src/
|
|
185
202
|
β βββ index.ts # Pi package entrypoint and helper export barrel
|
|
186
203
|
β βββ usage.ts # Menu, cache, and usage lifecycle orchestration
|
|
@@ -203,6 +220,8 @@ packages/pi-usage/
|
|
|
203
220
|
|
|
204
221
|
`index.ts` is the Pi entrypoint and forwards the default factory from `usage.ts` while retaining the package's named helper exports; other source modules are internal.
|
|
205
222
|
|
|
223
|
+
The generated runtime is built from the authoritative `src/index.ts` graph and does not import back into `src`.
|
|
224
|
+
|
|
206
225
|
## π Keywords
|
|
207
226
|
|
|
208
227
|
Pi extension, Pi coding agent, usage, quota, OpenAI Codex usage, ChatGPT subscription limits, GitHub Copilot AI credits, GitHub Copilot premium requests, OpenRouter credits, API-key spend limits, TypeScript Pi package, npm Pi extension.
|