@slkiser/opencode-quota 3.9.0 → 3.10.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 +216 -50
- package/dist/bin/opencode-quota.d.ts.map +1 -1
- package/dist/bin/opencode-quota.js +4 -1
- package/dist/bin/opencode-quota.js.map +1 -1
- package/dist/lib/cli-show.d.ts.map +1 -1
- package/dist/lib/cli-show.js +94 -3
- package/dist/lib/cli-show.js.map +1 -1
- package/dist/lib/command-handled.d.ts +2 -2
- package/dist/lib/command-handled.d.ts.map +1 -1
- package/dist/lib/command-handled.js +19 -4
- package/dist/lib/command-handled.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +60 -5
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/cursor-pricing.js +1 -1
- package/dist/lib/cursor-pricing.js.map +1 -1
- package/dist/lib/format-utils.d.ts +1 -0
- package/dist/lib/format-utils.d.ts.map +1 -1
- package/dist/lib/format-utils.js +8 -7
- package/dist/lib/format-utils.js.map +1 -1
- package/dist/lib/init-installer.d.ts.map +1 -1
- package/dist/lib/init-installer.js +6 -2
- package/dist/lib/init-installer.js.map +1 -1
- package/dist/lib/ollama-cloud.js +5 -5
- package/dist/lib/ollama-cloud.js.map +1 -1
- package/dist/lib/opencode-go.d.ts +12 -4
- package/dist/lib/opencode-go.d.ts.map +1 -1
- package/dist/lib/opencode-go.js +90 -7
- package/dist/lib/opencode-go.js.map +1 -1
- package/dist/lib/provider-metadata.d.ts +1 -1
- package/dist/lib/provider-metadata.d.ts.map +1 -1
- package/dist/lib/provider-metadata.js +0 -10
- package/dist/lib/provider-metadata.js.map +1 -1
- package/dist/lib/quota-command-format.d.ts +2 -0
- package/dist/lib/quota-command-format.d.ts.map +1 -1
- package/dist/lib/quota-command-format.js +4 -3
- package/dist/lib/quota-command-format.js.map +1 -1
- package/dist/lib/quota-dialog-commands.d.ts +43 -0
- package/dist/lib/quota-dialog-commands.d.ts.map +1 -0
- package/dist/lib/quota-dialog-commands.js +675 -0
- package/dist/lib/quota-dialog-commands.js.map +1 -0
- package/dist/lib/quota-export-types.d.ts +69 -0
- package/dist/lib/quota-export-types.d.ts.map +1 -0
- package/dist/lib/quota-export-types.js +9 -0
- package/dist/lib/quota-export-types.js.map +1 -0
- package/dist/lib/quota-export.d.ts +42 -0
- package/dist/lib/quota-export.d.ts.map +1 -0
- package/dist/lib/quota-export.js +130 -0
- package/dist/lib/quota-export.js.map +1 -0
- package/dist/lib/quota-render-data.d.ts +3 -0
- package/dist/lib/quota-render-data.d.ts.map +1 -1
- package/dist/lib/quota-render-data.js +22 -15
- package/dist/lib/quota-render-data.js.map +1 -1
- package/dist/lib/quota-state.d.ts +12 -0
- package/dist/lib/quota-state.d.ts.map +1 -1
- package/dist/lib/quota-state.js +38 -2
- package/dist/lib/quota-state.js.map +1 -1
- package/dist/lib/quota-stats-format.d.ts +5 -0
- package/dist/lib/quota-stats-format.d.ts.map +1 -1
- package/dist/lib/quota-stats-format.js +51 -13
- package/dist/lib/quota-stats-format.js.map +1 -1
- package/dist/lib/quota-status.d.ts.map +1 -1
- package/dist/lib/quota-status.js +0 -17
- package/dist/lib/quota-status.js.map +1 -1
- package/dist/lib/tui-runtime.d.ts +27 -0
- package/dist/lib/tui-runtime.d.ts.map +1 -1
- package/dist/lib/tui-runtime.js +120 -30
- package/dist/lib/tui-runtime.js.map +1 -1
- package/dist/lib/types.d.ts +16 -7
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +4 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/zai.d.ts.map +1 -1
- package/dist/lib/zai.js +8 -1
- package/dist/lib/zai.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +6 -476
- package/dist/plugin.js.map +1 -1
- package/dist/providers/cursor.js +1 -1
- package/dist/providers/cursor.js.map +1 -1
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +0 -2
- package/dist/providers/registry.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.tsx +252 -2
- package/package.json +2 -2
- package/dist/lib/crof-config.d.ts +0 -15
- package/dist/lib/crof-config.d.ts.map +0 -1
- package/dist/lib/crof-config.js +0 -33
- package/dist/lib/crof-config.js.map +0 -1
- package/dist/lib/crof.d.ts +0 -13
- package/dist/lib/crof.d.ts.map +0 -1
- package/dist/lib/crof.js +0 -70
- package/dist/lib/crof.js.map +0 -1
- package/dist/providers/crof.d.ts +0 -6
- package/dist/providers/crof.d.ts.map +0 -1
- package/dist/providers/crof.js +0 -56
- package/dist/providers/crof.js.map +0 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ The installer adds missing plugin/config entries and keeps your unrelated settin
|
|
|
35
35
|
| Question | Pick this when you want... |
|
|
36
36
|
| --- | --- |
|
|
37
37
|
| Install scope | This repo/worktree only, or your global OpenCode config. |
|
|
38
|
-
| Quota UI | Sidebar panel, toasts, compact status line, terminal
|
|
38
|
+
| Quota UI | Sidebar panel, toasts, compact status line, terminal command only, or a mix. Sidebar or Compact status installs the TUI plugin for slash-command dialogs. |
|
|
39
39
|
| Provider mode | Auto-detect providers, or choose a provider list yourself. |
|
|
40
40
|
| Quota reset periods | Show one reset period per provider, or all known reset periods. |
|
|
41
41
|
| Quota percentage meaning | Show quota remaining, or quota already used. |
|
|
@@ -45,9 +45,9 @@ The installer adds missing plugin/config entries and keeps your unrelated settin
|
|
|
45
45
|
### After install
|
|
46
46
|
|
|
47
47
|
1. Restart OpenCode.
|
|
48
|
-
2.
|
|
49
|
-
3. If something looks wrong, run `/quota_status
|
|
50
|
-
4. If you kept maintainer announcements enabled and installed the TUI plugin, the home screen can show `Notice: Maintainer announcement available. Run /quota_announcements.` or the plural count form. Without the TUI plugin, the same count-only notice can appear once after the first visible quota toast. Run `/quota_announcements` to read active notices.
|
|
48
|
+
2. If you selected Sidebar or Compact status, run `/quota`. If you selected Toast-only or Terminal command only, use `opencode-quota show` or add the TUI plugin manually for slash commands.
|
|
49
|
+
3. If something looks wrong and the TUI plugin is installed, run `/quota_status`; otherwise run `opencode-quota show` from your terminal.
|
|
50
|
+
4. If you kept maintainer announcements enabled and installed the TUI plugin, the home screen can show `Notice: Maintainer announcement available. Run /quota_announcements.` or the plural count form. Without the TUI plugin, the same count-only notice can appear once after the first visible quota toast. Run `/quota_announcements` to read active notices when the TUI plugin is installed.
|
|
51
51
|
5. If you enabled the Sidebar panel, open the session sidebar and look for `Quota`.
|
|
52
52
|
6. If you enabled Compact status line, look for the home-bottom quota line and the chat/session prompt quota line.
|
|
53
53
|
|
|
@@ -70,8 +70,8 @@ opencode-quota show --provider copilot
|
|
|
70
70
|
- A `Quota` Sidebar panel in the TUI
|
|
71
71
|
- Popup quota toasts in OpenCode
|
|
72
72
|
- A Compact status line in the TUI
|
|
73
|
-
- `/quota`, `/quota_status`, and `/quota_announcements` slash commands
|
|
74
|
-
- Token reports such as `/tokens_today` and `/tokens_weekly`
|
|
73
|
+
- `/quota`, `/quota_status`, and `/quota_announcements` slash commands when the TUI plugin is installed
|
|
74
|
+
- Token reports such as `/tokens_today` and `/tokens_weekly` when the TUI plugin is installed
|
|
75
75
|
- Provider diagnostics for auth, quota sources, pricing, and bundled maintainer announcements
|
|
76
76
|
|
|
77
77
|
<table>
|
|
@@ -97,7 +97,7 @@ opencode-quota show --provider copilot
|
|
|
97
97
|
</tr>
|
|
98
98
|
<tr>
|
|
99
99
|
<td width="50%" align="center">Compact status line</td>
|
|
100
|
-
<td width="50%" align="center"><code>/tokens_weekly</code> report</td>
|
|
100
|
+
<td width="50%" align="center"><code>/tokens_weekly</code> TUI report</td>
|
|
101
101
|
</tr>
|
|
102
102
|
</table>
|
|
103
103
|
|
|
@@ -111,7 +111,7 @@ Use the installer when possible. For manual setup, use the same OpenCode config
|
|
|
111
111
|
|
|
112
112
|
### 1. Add the server plugin (required)
|
|
113
113
|
|
|
114
|
-
This enables providers,
|
|
114
|
+
This enables providers, terminal checks, popup toasts, and the `tool.quota_status` tool. Add this to `opencode.json` or `opencode.jsonc`:
|
|
115
115
|
|
|
116
116
|
```jsonc
|
|
117
117
|
{
|
|
@@ -120,9 +120,9 @@ This enables providers, slash commands, terminal checks, and popup toasts. Add t
|
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
### 2. Add the TUI plugin (for
|
|
123
|
+
### 2. Add the TUI plugin (for dialog slash commands and TUI surfaces)
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Add this to `tui.json` or `tui.jsonc` for `/quota`, `/quota_status`, `/quota_announcements`, `/pricing_refresh`, `/tokens_*` dialog slash commands, the Sidebar panel, Compact status line, and maintainer announcement home notices:
|
|
126
126
|
|
|
127
127
|
```jsonc
|
|
128
128
|
{
|
|
@@ -159,7 +159,7 @@ Start with this, then adjust the UI choices in the next section:
|
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
> [!TIP]
|
|
162
|
-
>
|
|
162
|
+
> When the TUI plugin is installed, run `/quota_status` to see the exact config paths OpenCode Quota loaded.
|
|
163
163
|
|
|
164
164
|
## Choose your UI surfaces
|
|
165
165
|
|
|
@@ -171,7 +171,8 @@ All UI surfaces use the same quota data. Put these settings in `opencode-quota/q
|
|
|
171
171
|
| Toast | `enableToast: true` | Popup toast after idle/question/compact events. Requires the server plugin entry above. |
|
|
172
172
|
| Compact status line | `tuiCompactStatus.enabled: true` | Short text-only quota line at the home bottom and chat/session prompt locations, for example `Copilot 94% | OpenAI Pro 5h 100%, 7d 100%`. Requires the TUI plugin entry above. |
|
|
173
173
|
| Maintainer announcement notice | `maintainerAnnouncements.enabled: true`, `maintainerAnnouncements.home: true` | Prefers the TUI home notice when the quota TUI plugin is configured. Without the TUI plugin, shows the same count-only notice once after the first visible quota toast. |
|
|
174
|
-
|
|
|
174
|
+
| Dialog slash commands | TUI plugin entry in `tui.json` | `/quota`, `/quota_status`, `/quota_announcements`, `/pricing_refresh`, and `/tokens_*` open local TUI dialogs. They do not call the model and do not write command output to the OpenCode session transcript. |
|
|
175
|
+
| Terminal command only | `enableToast: false`, `tuiSidebarPanel.enabled: false`, `tuiCompactStatus.enabled: false`, `maintainerAnnouncements.enabled: false` | Keeps `opencode-quota show` terminal checks while hiding optional toast/sidebar/compact/home surfaces. Does not install TUI slash-command dialogs. |
|
|
175
176
|
|
|
176
177
|
Selecting Compact status line in the installer enables both compact surfaces by default. To keep compact status home-only, set `tuiCompactStatus.sessionPrompt: false`.
|
|
177
178
|
|
|
@@ -181,9 +182,13 @@ For more examples, see [Common configuration](#common-configuration). For every
|
|
|
181
182
|
|
|
182
183
|
## Commands
|
|
183
184
|
|
|
185
|
+
Slash commands require the TUI plugin entry in `tui.json` and open deterministic local dialogs. The installer adds that entry only when you select Sidebar or Compact status. They do not invoke a model and do not write command output into the OpenCode session transcript. Session-scoped token commands require an active TUI session.
|
|
186
|
+
|
|
184
187
|
| Command | What it shows |
|
|
185
188
|
| --- | --- |
|
|
186
189
|
| `opencode-quota show` | Terminal quota-only quick glance |
|
|
190
|
+
| `opencode-quota show --json` | Machine-readable JSON output for external tools |
|
|
191
|
+
| `opencode-quota show --json --threshold <pct>` | Exit `1` if cached quota is below `<pct>%`; exit `2` if none can be compared |
|
|
187
192
|
| `/quota` | Detailed quota report |
|
|
188
193
|
| `/quota_status` | Config, provider, auth, pricing, `enabled`/`home` announcement config, `source=bundled_only`, `network=false`, and active/future/expired announcement counts |
|
|
189
194
|
| `/quota_announcements` | List active bundled maintainer notices |
|
|
@@ -213,7 +218,6 @@ Most providers work automatically. If a provider has a “Needs setup” link, o
|
|
|
213
218
|
| MiniMax Coding Plan (CN) | OpenCode config | Remote API | Usage/quota |
|
|
214
219
|
| Kimi Code | OpenCode config | Remote API | Usage/quota |
|
|
215
220
|
| Chutes AI | API key/config | Remote API | Usage/quota |
|
|
216
|
-
| Crof.ai | Manual env/config/auth | Remote API | Usage/quota |
|
|
217
221
|
| Synthetic | Automatic | Remote API | Quota |
|
|
218
222
|
| Google Antigravity | [Needs setup](#google-antigravity) | Remote API | Usage/quota |
|
|
219
223
|
| Gemini CLI | [Needs setup](#gemini-cli) | Remote API | Usage/quota |
|
|
@@ -234,11 +238,11 @@ Common locations:
|
|
|
234
238
|
- Global install: usually `~/.config/opencode/opencode-quota/quota-toast.json`
|
|
235
239
|
- Custom config dir: `$OPENCODE_CONFIG_DIR/opencode-quota/quota-toast.json`
|
|
236
240
|
|
|
237
|
-
If you are unsure, run `/quota_status`;
|
|
241
|
+
If you are unsure and the TUI plugin is installed, run `/quota_status`; otherwise check the install-scope paths above.
|
|
238
242
|
|
|
239
243
|
### Maintainer announcements and privacy
|
|
240
244
|
|
|
241
|
-
Announcements are bundled only: no remote fetches, announcement telemetry, or persisted dismiss state.
|
|
245
|
+
Announcements are bundled only: no remote fetches, announcement telemetry, or persisted dismiss state. When the TUI plugin is installed, use `/quota_announcements` to read active notices and `/quota_status` for counts/diagnostics. See **Configure maintainer announcements** below for options.
|
|
242
246
|
|
|
243
247
|
<details>
|
|
244
248
|
<summary><strong>Choose providers explicitly</strong></summary>
|
|
@@ -276,7 +280,7 @@ Announcements are bundled only: no remote fetches, announcement telemetry, or pe
|
|
|
276
280
|
<details>
|
|
277
281
|
<summary><strong>Turn off popup toasts</strong></summary>
|
|
278
282
|
|
|
279
|
-
Keeps
|
|
283
|
+
Keeps terminal checks, any enabled UI surfaces, and `/quota`/`/quota_status` when the TUI plugin is installed.
|
|
280
284
|
|
|
281
285
|
```jsonc
|
|
282
286
|
{
|
|
@@ -298,14 +302,14 @@ Keeps `/quota`, `/quota_status`, terminal checks, and any enabled UI surfaces.
|
|
|
298
302
|
}
|
|
299
303
|
```
|
|
300
304
|
|
|
301
|
-
Set `enabled: false` to disable automatic announcement surfaces. `/quota_announcements` lists active bundled notices
|
|
305
|
+
Set `enabled: false` to disable automatic announcement surfaces. When the TUI plugin is installed, `/quota_announcements` lists active bundled notices while announcements are enabled.
|
|
302
306
|
|
|
303
307
|
</details>
|
|
304
308
|
|
|
305
309
|
<details>
|
|
306
310
|
<summary><strong>Turn off the Sidebar panel</strong></summary>
|
|
307
311
|
|
|
308
|
-
Useful when you want Compact status line only, toasts only, or slash
|
|
312
|
+
Useful when you want Compact status line only, toasts only, or installed TUI slash dialogs without the Sidebar panel.
|
|
309
313
|
|
|
310
314
|
```jsonc
|
|
311
315
|
{
|
|
@@ -345,6 +349,21 @@ Useful when you want the compact line on the home screen but not in the chat/ses
|
|
|
345
349
|
|
|
346
350
|
</details>
|
|
347
351
|
|
|
352
|
+
<details>
|
|
353
|
+
<summary><strong>Write quota export file</strong></summary>
|
|
354
|
+
|
|
355
|
+
Writes a JSON file after each TUI background refresh for consumption by external tools (tmux, scripts, CI). See [External integration](#external-integration).
|
|
356
|
+
|
|
357
|
+
```jsonc
|
|
358
|
+
{
|
|
359
|
+
"export": {
|
|
360
|
+
"enabled": true,
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
</details>
|
|
366
|
+
|
|
348
367
|
<details>
|
|
349
368
|
<summary><strong>Advanced: legacy config sync</strong></summary>
|
|
350
369
|
|
|
@@ -371,22 +390,22 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
371
390
|
|
|
372
391
|
| Option | Default | Meaning |
|
|
373
392
|
| --- | --- | --- |
|
|
374
|
-
| `enabled` | `true` | Master switch for quota collection and handled slash commands. When `false`, `/quota`, `/quota_status`, `/pricing_refresh`, and `/tokens_*` are handled as no-ops. |
|
|
393
|
+
| `enabled` | `true` | Master switch for quota collection and handled slash commands when the TUI plugin is installed. When `false`, `/quota`, `/quota_status`, `/pricing_refresh`, and `/tokens_*` are handled as no-ops. |
|
|
375
394
|
| `enabledProviders` | `"auto"` | Auto-detect providers, or set an explicit provider list. |
|
|
376
395
|
| `minIntervalMs` | `300000` | Minimum fetch interval between provider updates. |
|
|
377
396
|
| `requestTimeoutMs` | `5000` | Remote provider request timeout in milliseconds. |
|
|
378
|
-
| `formatStyle` | `singleWindow` | Shared quota reset-period display for popup toasts
|
|
379
|
-
| `percentDisplayMode` | `remaining` | Shared quota percentage meaning for popup toasts and the
|
|
397
|
+
| `formatStyle` | `singleWindow` | Shared quota reset-period display for popup toasts, the Sidebar panel, and Compact status line unless a TUI surface override is set: `singleWindow` shows one reset period per provider; `allWindows` shows all reset periods per provider. Legacy `classic`/`grouped` aliases are still accepted. |
|
|
398
|
+
| `percentDisplayMode` | `remaining` | Shared quota percentage meaning for popup toasts, the Sidebar panel, and `/quota` when the TUI plugin is installed: `remaining` shows quota left; `used` shows quota consumed. |
|
|
380
399
|
| `onlyCurrentModel` | `false` | Filter quota rows to the current model/provider when that session selection can be resolved. |
|
|
381
400
|
| `showSessionTokens` | `true` | Show the `Session input/output tokens` section when session token data is available. When cached input is present, the section keeps the legacy `in/out` layout and appends cached input in parentheses next to the input amount. |
|
|
382
|
-
| `pricingSnapshot.source` | `"auto"` | Token pricing snapshot selection for `/tokens_
|
|
401
|
+
| `pricingSnapshot.source` | `"auto"` | Token pricing snapshot selection for `/tokens_*` when the TUI plugin is installed: `auto`, `bundled`, or `runtime`. |
|
|
383
402
|
| `pricingSnapshot.autoRefresh` | `7` | Refresh stale local pricing data after this many days. |
|
|
384
403
|
|
|
385
404
|
### Toast settings
|
|
386
405
|
|
|
387
406
|
| Option | Default | Meaning |
|
|
388
407
|
| --- | --- | --- |
|
|
389
|
-
| `enableToast` | `true` | Show popup toasts. Disabling this does not disable `/quota`
|
|
408
|
+
| `enableToast` | `true` | Show popup toasts. Disabling this does not disable terminal checks, UI surfaces, or `/quota` when the TUI plugin is installed. |
|
|
390
409
|
| `toastDurationMs` | `9000` | Toast duration in milliseconds. |
|
|
391
410
|
| `showOnIdle` | `true` | Show a toast on the idle trigger. |
|
|
392
411
|
| `showOnQuestion` | `true` | Show a toast after a question/assistant response. |
|
|
@@ -402,11 +421,13 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
402
421
|
| Option | Default | Meaning |
|
|
403
422
|
| --- | --- | --- |
|
|
404
423
|
| `tuiSidebarPanel.enabled` | `true` | Show the Sidebar `Quota` panel when the TUI plugin is installed. Click the panel header to toggle between compact summary and detailed all-windows views; OpenCode remembers the last state. |
|
|
424
|
+
| `tuiSidebarPanel.formatStyle` | (root `formatStyle`) | Override `formatStyle` for the Sidebar panel only. Useful when you want `allWindows` detail in the sidebar but a different style elsewhere. |
|
|
405
425
|
| `tuiCompactStatus.enabled` | `false` | Opt in to Compact status line UI surfaces. |
|
|
406
426
|
| `tuiCompactStatus.homeBottom` | `true` | Show the Compact status line at the home bottom location. |
|
|
407
427
|
| `tuiCompactStatus.sessionPrompt` | `true` | Show the Compact status line by wrapping the TUI session prompt. Disable this if you only want the home-bottom line. |
|
|
408
428
|
| `tuiCompactStatus.suppressWhenNativeProviderQuota` | `true` | Hide the Compact status line when OpenCode exposes native provider-quota support. |
|
|
409
429
|
| `tuiCompactStatus.maxWidth` | `96` | Maximum Compact status line text width. |
|
|
430
|
+
| `tuiCompactStatus.formatStyle` | (root `formatStyle`) | Override `formatStyle` for the Compact status line only. Useful when you want `singleWindow` on the compact line while the sidebar shows `allWindows`. |
|
|
410
431
|
|
|
411
432
|
### Maintainer announcement settings
|
|
412
433
|
|
|
@@ -427,8 +448,152 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
427
448
|
| `cursorIncludedApiUsd` | unset | Override Cursor monthly included API budget in USD. |
|
|
428
449
|
| `cursorBillingCycleStartDay` | unset | Local billing-cycle anchor day `1..28`; when unset, Cursor usage resets on the local calendar month. |
|
|
429
450
|
|
|
451
|
+
### Export settings
|
|
452
|
+
|
|
453
|
+
| Option | Default | Meaning |
|
|
454
|
+
| --- | --- | --- |
|
|
455
|
+
| `export.enabled` | `false` | Write a JSON export file after each TUI background refresh. |
|
|
456
|
+
| `export.path` | `""` | Export file path. Empty string uses the XDG default: `$XDG_CACHE_HOME/opencode/quota-export.json`. Supports `~/` expansion. |
|
|
457
|
+
|
|
430
458
|
</details>
|
|
431
459
|
|
|
460
|
+
## External integration
|
|
461
|
+
|
|
462
|
+
Quota data is available to external tools via two surfaces that emit the same JSON schema. Both read from the per-provider disk cache — no extra network requests.
|
|
463
|
+
|
|
464
|
+
### CLI: `show --json`
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
opencode-quota show --json [--threshold <pct>] [--provider <id>]
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
| Flag | Behavior |
|
|
471
|
+
|---|---|
|
|
472
|
+
| `--json` | Emit JSON to stdout instead of human-readable text. Reads from the disk cache only — no network calls |
|
|
473
|
+
| `--provider <id>` | Include only one provider key, using the same provider IDs accepted by `show` |
|
|
474
|
+
| `--threshold <pct>` | With `--json`, exit `1` if any comparable cached percentage is below `<pct>`% remaining; exit `2` if there is no cached percentage to compare |
|
|
475
|
+
|
|
476
|
+
`--json` reads from the per-provider disk cache populated by normal quota refreshes. If no cached entry exists for a provider, that provider is reported as `unavailable`.
|
|
477
|
+
|
|
478
|
+
### Export file (TUI background writer)
|
|
479
|
+
|
|
480
|
+
When enabled, the TUI writes a unified JSON file after each home-bottom background refresh (same 60 s interval). The export writer reads the existing provider cache and does not fetch quota itself.
|
|
481
|
+
|
|
482
|
+
```jsonc
|
|
483
|
+
// opencode-quota/quota-toast.json
|
|
484
|
+
{
|
|
485
|
+
"export": {
|
|
486
|
+
"enabled": true,
|
|
487
|
+
"path": "" // XDG cache default: $XDG_CACHE_HOME/opencode/quota-export.json
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
The file is written atomically. Write errors are logged as a warning and never affect TUI rendering.
|
|
493
|
+
|
|
494
|
+
### JSON schema
|
|
495
|
+
|
|
496
|
+
Both surfaces emit the same structure:
|
|
497
|
+
|
|
498
|
+
```jsonc
|
|
499
|
+
{
|
|
500
|
+
"version": 1,
|
|
501
|
+
"exportedAt": 1748736000, // unix seconds
|
|
502
|
+
"fromCache": true,
|
|
503
|
+
"cacheAgeSeconds": 42, // age of the oldest provider entry
|
|
504
|
+
"providers": {
|
|
505
|
+
"copilot": {
|
|
506
|
+
"status": "ok",
|
|
507
|
+
"fetchedAt": 1748735958,
|
|
508
|
+
"entries": [
|
|
509
|
+
{
|
|
510
|
+
"name": "Premium Requests",
|
|
511
|
+
"window": "Monthly",
|
|
512
|
+
"percentRemaining": 62.3,
|
|
513
|
+
"resetAt": 1748908800,
|
|
514
|
+
"unlimited": false
|
|
515
|
+
}
|
|
516
|
+
]
|
|
517
|
+
},
|
|
518
|
+
"opencode-go": {
|
|
519
|
+
"status": "error",
|
|
520
|
+
"fetchedAt": 1748735958,
|
|
521
|
+
"error": "Request timeout after 5000ms"
|
|
522
|
+
},
|
|
523
|
+
"anthropic": {
|
|
524
|
+
"status": "unavailable" // no cached quota is available
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
Provider `status` values:
|
|
531
|
+
|
|
532
|
+
| Value | Meaning |
|
|
533
|
+
|---|---|
|
|
534
|
+
| `ok` | Cached fetch succeeded; `entries` is populated |
|
|
535
|
+
| `error` | Cached fetch was attempted but failed; `error` has the message |
|
|
536
|
+
| `unavailable` | No cached quota is available, such as missing credentials or no prior refresh |
|
|
537
|
+
|
|
538
|
+
Optional fields: `window` is present only when a provider row reports one, `percentRemaining` is absent for value-only rows, and `resetAt` is absent when the provider does not report a reset time.
|
|
539
|
+
|
|
540
|
+
### Integration examples
|
|
541
|
+
|
|
542
|
+
**CI gate — abort if quota is low:**
|
|
543
|
+
```bash
|
|
544
|
+
npx @slkiser/opencode-quota show --json --threshold 5
|
|
545
|
+
# exits 1 if any comparable cached provider is below 5% remaining
|
|
546
|
+
# exits 2 if there is no cached percentage to compare
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**Shell script — branch on remaining quota:**
|
|
550
|
+
```bash
|
|
551
|
+
PCT=$(opencode-quota show --json | jq '.providers["copilot"].entries[0].percentRemaining')
|
|
552
|
+
(( ${PCT%.*} < 10 )) && echo "Low quota, skipping." && exit 0
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**tmux status-right — reads export file (no subprocess per refresh):**
|
|
556
|
+
```bash
|
|
557
|
+
# ~/.tmux.conf
|
|
558
|
+
set -g status-interval 30
|
|
559
|
+
set -g status-right '#(jq -r "[.providers|to_entries[]|select(.value.status==\"ok\")|(.value.entries[0].percentRemaining|floor|tostring)+\"%\"]|join(\" · \")" ~/.cache/opencode/quota-export.json 2>/dev/null)'
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
**Starship prompt — reads cache directly (no TUI needed):**
|
|
563
|
+
```toml
|
|
564
|
+
# starship.toml
|
|
565
|
+
[custom.quota]
|
|
566
|
+
command = "opencode-quota show --json 2>/dev/null | jq -r '[.providers|to_entries[]|select(.value.status==\"ok\")|(.value.entries[0].percentRemaining|floor|tostring)+\"%\"]|join(\" \")'"
|
|
567
|
+
when = "true"
|
|
568
|
+
interval = 60
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
**File-watch push — event-driven, zero polling:**
|
|
572
|
+
```bash
|
|
573
|
+
# macOS
|
|
574
|
+
fswatch -o ~/.cache/opencode/quota-export.json | xargs -I{} my-status-refresh
|
|
575
|
+
|
|
576
|
+
# Linux
|
|
577
|
+
inotifywait -m -e close_write ~/.cache/opencode/quota-export.json \
|
|
578
|
+
| while read; do my-status-refresh; done
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
**LLM proxy router — pick the provider with the most headroom:**
|
|
582
|
+
```python
|
|
583
|
+
import json, subprocess
|
|
584
|
+
|
|
585
|
+
data = json.loads(subprocess.check_output(
|
|
586
|
+
["opencode-quota", "show", "--json"], timeout=1
|
|
587
|
+
))
|
|
588
|
+
best = max(
|
|
589
|
+
(k for k, v in data["providers"].items() if v["status"] == "ok"),
|
|
590
|
+
key=lambda k: next(
|
|
591
|
+
(e.get("percentRemaining", 0) for e in data["providers"][k]["entries"]), 0
|
|
592
|
+
),
|
|
593
|
+
default=None,
|
|
594
|
+
)
|
|
595
|
+
```
|
|
596
|
+
|
|
432
597
|
## Provider setup notes
|
|
433
598
|
|
|
434
599
|
<a id="anthropic-claude"></a>
|
|
@@ -554,7 +719,7 @@ Use `opencodeGoWindows` to choose **5h**, **Weekly**, and/or **Monthly** windows
|
|
|
554
719
|
|
|
555
720
|
Start here when quota or token data looks wrong.
|
|
556
721
|
|
|
557
|
-
1.
|
|
722
|
+
1. When the TUI plugin is installed, run `/quota_status`; otherwise start with `opencode-quota show` for a terminal quota summary.
|
|
558
723
|
2. Confirm the expected provider appears in the detected provider list.
|
|
559
724
|
3. Confirm companion auth plugins are before `@slkiser/opencode-quota` in `opencode.json`.
|
|
560
725
|
4. If token reports are empty, start OpenCode once so it creates `opencode.db`, then run a session with model usage.
|
|
@@ -564,28 +729,30 @@ Start here when quota or token data looks wrong.
|
|
|
564
729
|
|
|
565
730
|
| Symptom | Try this |
|
|
566
731
|
| --- | --- |
|
|
567
|
-
| `/quota`
|
|
732
|
+
| `/quota` or other slash commands do not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, then restart OpenCode. |
|
|
733
|
+
| `/quota` shows no providers | Run `/quota_status` when the TUI plugin is installed, then check provider detection and auth. Without the TUI plugin, use `opencode-quota show` for a terminal quota summary. |
|
|
568
734
|
| Sidebar panel does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, and check `tuiSidebarPanel.enabled`. |
|
|
569
735
|
| Compact status line does not appear anywhere | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, check `tuiCompactStatus.enabled`, and check whether `tuiCompactStatus.suppressWhenNativeProviderQuota` is hiding it because OpenCode exposes native provider-quota support. |
|
|
570
736
|
| Compact status appears on home but not in chat/session | Check `tuiCompactStatus.sessionPrompt`; set it to `true` to show the chat/session prompt line. |
|
|
571
737
|
| Popup toasts do not appear | Check `enableToast`, `showOnIdle`, `showOnQuestion`, and `showOnCompact`. |
|
|
572
|
-
| Announcement home notice does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, then check `maintainerAnnouncements.enabled`, `maintainerAnnouncements.home`, and the active count in the `maintainer_announcements` section of `/quota_status`. |
|
|
738
|
+
| Announcement home notice does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, then check `maintainerAnnouncements.enabled`, `maintainerAnnouncements.home`, and, when the TUI plugin is installed, the active count in the `maintainer_announcements` section of `/quota_status`. |
|
|
573
739
|
| Token reports are empty | Start OpenCode once so `opencode.db` exists, then run a session with model usage. |
|
|
574
|
-
| Pricing looks stale | Run `/pricing_refresh
|
|
740
|
+
| Pricing looks stale | Run `/pricing_refresh` when the TUI plugin is installed. |
|
|
741
|
+
| `/tokens_between` needs dates | When the TUI plugin is installed, run `/tokens_between YYYY-MM-DD YYYY-MM-DD`; if your OpenCode build does not pass slash arguments to TUI commands, the dialog shows the expected format. |
|
|
575
742
|
|
|
576
743
|
### Provider troubleshooting
|
|
577
744
|
|
|
578
745
|
<details>
|
|
579
746
|
<summary><strong>Anthropic (Claude)</strong></summary>
|
|
580
747
|
|
|
581
|
-
|
|
748
|
+
When the TUI plugin is installed, run `/quota_status` and check the Anthropic section.
|
|
582
749
|
|
|
583
750
|
| Symptom | Fix |
|
|
584
751
|
| --- | --- |
|
|
585
752
|
| `claude` not found | Install Claude Code and make sure `claude` is on your `PATH`. |
|
|
586
753
|
| Claude is installed at a custom path | Set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`. |
|
|
587
754
|
| Not authenticated | Run `claude auth login`, then confirm `claude auth status` works. |
|
|
588
|
-
| Auth works but no quota rows appear |
|
|
755
|
+
| Auth works but no quota rows appear | When the TUI plugin is installed, check `quota_source` and `message` in `/quota_status`; re-authenticate Claude if the OAuth credential fallback is missing or stale. |
|
|
589
756
|
| Provider not detected | Confirm OpenCode is configured to use the `anthropic` provider. |
|
|
590
757
|
|
|
591
758
|
</details>
|
|
@@ -593,7 +760,7 @@ Run `/quota_status` and check the Anthropic section.
|
|
|
593
760
|
<details>
|
|
594
761
|
<summary><strong>GitHub Copilot</strong></summary>
|
|
595
762
|
|
|
596
|
-
|
|
763
|
+
When the TUI plugin is installed, run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_scope`, and `quota_api`.
|
|
597
764
|
|
|
598
765
|
| Symptom | Fix |
|
|
599
766
|
| --- | --- |
|
|
@@ -607,7 +774,7 @@ Run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_sco
|
|
|
607
774
|
<details>
|
|
608
775
|
<summary><strong>OpenAI</strong></summary>
|
|
609
776
|
|
|
610
|
-
|
|
777
|
+
When the TUI plugin is installed, run `/quota_status` and check the OpenAI auth source and token status.
|
|
611
778
|
|
|
612
779
|
| Symptom | Fix |
|
|
613
780
|
| --- | --- |
|
|
@@ -620,7 +787,7 @@ Run `/quota_status` and check the OpenAI auth source and token status.
|
|
|
620
787
|
<details>
|
|
621
788
|
<summary><strong>Cursor</strong></summary>
|
|
622
789
|
|
|
623
|
-
|
|
790
|
+
When the TUI plugin is installed, run `/quota_status` and check the Cursor section.
|
|
624
791
|
|
|
625
792
|
| Symptom | Fix |
|
|
626
793
|
| --- | --- |
|
|
@@ -628,42 +795,42 @@ Run `/quota_status` and check the Cursor section.
|
|
|
628
795
|
| Cursor auth missing | Run `opencode auth login --provider cursor`. |
|
|
629
796
|
| Quota appears but no remaining percentage | Set `cursorPlan` or `cursorIncludedApiUsd` in `opencode-quota/quota-toast.json`. |
|
|
630
797
|
| Billing cycle looks wrong | Set `cursorBillingCycleStartDay` in `opencode-quota/quota-toast.json` to your local billing anchor day. |
|
|
631
|
-
| Unknown Cursor pricing | Run `/pricing_refresh
|
|
798
|
+
| Unknown Cursor pricing | Run `/pricing_refresh` when the TUI plugin is installed; if still unknown, check `/quota_status` for unknown model ids. |
|
|
632
799
|
|
|
633
800
|
</details>
|
|
634
801
|
|
|
635
802
|
<details>
|
|
636
803
|
<summary><strong>Qwen Code</strong></summary>
|
|
637
804
|
|
|
638
|
-
|
|
805
|
+
When the TUI plugin is installed, run `/quota_status` and check `qwen_oauth_source`, `qwen_local_plan`, and the `qwen_code` live probe section.
|
|
639
806
|
|
|
640
807
|
| Symptom | Fix |
|
|
641
808
|
| --- | --- |
|
|
642
809
|
| Qwen not detected | Put `opencode-qwencode-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
643
810
|
| Auth missing | Complete the Qwen companion plugin auth flow. |
|
|
644
811
|
| Counters do not move | Confirm the current model is `qwen-code/*`; Qwen quota is local request estimation for matching model usage. |
|
|
645
|
-
| Usage looks stale |
|
|
812
|
+
| Usage looks stale | When the TUI plugin is installed, check the local state file path shown by `/quota_status`. |
|
|
646
813
|
|
|
647
814
|
</details>
|
|
648
815
|
|
|
649
816
|
<details>
|
|
650
817
|
<summary><strong>Alibaba Coding Plan</strong></summary>
|
|
651
818
|
|
|
652
|
-
|
|
819
|
+
When the TUI plugin is installed, run `/quota_status` and check the Alibaba auth, resolved tier, state-file path, and `alibaba_coding_plan` live probe section.
|
|
653
820
|
|
|
654
821
|
| Symptom | Fix |
|
|
655
822
|
| --- | --- |
|
|
656
823
|
| API key not detected | Use `ALIBABA_CODING_PLAN_API_KEY`, `ALIBABA_API_KEY`, trusted user/global OpenCode config, or OpenCode auth. Repo-local provider secrets are ignored. |
|
|
657
824
|
| Wrong tier | Set `alibabaCodingPlanTier` to `lite` or `pro` in `opencode-quota/quota-toast.json`. |
|
|
658
825
|
| Counters do not move | Confirm the current model is `alibaba/*` or `alibaba-cn/*`. |
|
|
659
|
-
| Quota seems stale |
|
|
826
|
+
| Quota seems stale | When the TUI plugin is installed, check the state-file path shown in `/quota_status`. |
|
|
660
827
|
|
|
661
828
|
</details>
|
|
662
829
|
|
|
663
830
|
<details>
|
|
664
|
-
<summary><strong>MiniMax, Kimi, Chutes AI,
|
|
831
|
+
<summary><strong>MiniMax, Kimi, Chutes AI, Synthetic, Z.ai, Zhipu, NanoGPT, and DeepSeek</strong></summary>
|
|
665
832
|
|
|
666
|
-
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth.
|
|
833
|
+
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth. When the TUI plugin is installed, run `/quota_status` and check the provider-specific API-key diagnostics.
|
|
667
834
|
|
|
668
835
|
| Provider | Useful checks |
|
|
669
836
|
| --- | --- |
|
|
@@ -671,7 +838,6 @@ These providers use trusted env vars, trusted user/global OpenCode config, or na
|
|
|
671
838
|
| MiniMax Coding Plan (CN) | Use `MINIMAX_CHINA_CODING_PLAN_API_KEY` or trusted user/global OpenCode config under `minimax-china-coding-plan`, `minimax-cn-coding-plan`, `minimax-cn`, or `minimax-china`. Runtime id `minimax-cn-coding-plan` uses this provider. |
|
|
672
839
|
| Kimi Code | Use `KIMI_API_KEY` or `KIMI_CODE_API_KEY`; repo-local provider secrets are ignored. |
|
|
673
840
|
| Chutes AI | Use `CHUTES_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
674
|
-
| Crof.ai | Use `CROF_API_KEY`, `CROFAI_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
675
841
|
| Synthetic | Use `SYNTHETIC_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
676
842
|
| Z.ai Coding Plan | Use `ZAI_API_KEY` or `ZAI_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
677
843
|
| Zhipu Coding Plan | Use `ZHIPU_API_KEY` or `ZHIPU_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
@@ -685,21 +851,21 @@ For security, repo-local `opencode.json` / `opencode.jsonc` is ignored for provi
|
|
|
685
851
|
<details>
|
|
686
852
|
<summary><strong>Google Antigravity</strong></summary>
|
|
687
853
|
|
|
688
|
-
|
|
854
|
+
When the TUI plugin is installed, run `/quota_status` and check the `google_antigravity` section.
|
|
689
855
|
|
|
690
856
|
| Symptom | Fix |
|
|
691
857
|
| --- | --- |
|
|
692
858
|
| Companion missing | Put `opencode-antigravity-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
693
|
-
| Accounts not found |
|
|
859
|
+
| Accounts not found | When the TUI plugin is installed, check the selected `antigravity-accounts.json` path shown by `/quota_status`. |
|
|
694
860
|
| Refresh tokens invalid | Re-authenticate with the companion plugin. |
|
|
695
|
-
| Provider returns no rows |
|
|
861
|
+
| Provider returns no rows | When the TUI plugin is installed, check `live_probe`, `live_entry_*`, and `live_error_*` in `/quota_status`. |
|
|
696
862
|
|
|
697
863
|
</details>
|
|
698
864
|
|
|
699
865
|
<details>
|
|
700
866
|
<summary><strong>Gemini CLI</strong></summary>
|
|
701
867
|
|
|
702
|
-
|
|
868
|
+
When the TUI plugin is installed, run `/quota_status` and check the Gemini CLI live probe rows.
|
|
703
869
|
|
|
704
870
|
| Symptom | Fix |
|
|
705
871
|
| --- | --- |
|
|
@@ -713,14 +879,14 @@ Run `/quota_status` and check the Gemini CLI live probe rows.
|
|
|
713
879
|
<details>
|
|
714
880
|
<summary><strong>OpenCode Go</strong></summary>
|
|
715
881
|
|
|
716
|
-
|
|
882
|
+
When the TUI plugin is installed, run `/quota_status` and check the `opencode_go` section.
|
|
717
883
|
|
|
718
884
|
| Symptom | Fix |
|
|
719
885
|
| --- | --- |
|
|
720
|
-
| Config not detected | Set both `OPENCODE_GO_WORKSPACE_ID` and `OPENCODE_GO_AUTH_COOKIE`, then rerun `/quota_status
|
|
886
|
+
| Config not detected | Set both `OPENCODE_GO_WORKSPACE_ID` and `OPENCODE_GO_AUTH_COOKIE`, then rerun `/quota_status` when the TUI plugin is installed. |
|
|
721
887
|
| Incomplete config | `workspaceId` and `authCookie` must come from the same source. |
|
|
722
888
|
| Scrape returns no data | Refresh the browser `auth` cookie from `opencode.ai`. |
|
|
723
|
-
| Selected window missing |
|
|
889
|
+
| Selected window missing | When the TUI plugin is installed, check `/quota_status` for `selected_windows` and `live_fetch_error`; remove unavailable windows from `opencodeGoWindows` in `opencode-quota/quota-toast.json` or refresh the dashboard cookie. |
|
|
724
890
|
| Dashboard format changed | This integration scrapes the dashboard, so it can break if the dashboard markup changes. |
|
|
725
891
|
|
|
726
892
|
</details>
|
|
@@ -728,14 +894,14 @@ Run `/quota_status` and check the `opencode_go` section.
|
|
|
728
894
|
<details>
|
|
729
895
|
<summary><strong>Token reports</strong></summary>
|
|
730
896
|
|
|
731
|
-
|
|
897
|
+
When the TUI plugin is installed, run `/quota_status` and check pricing snapshot health plus OpenCode database paths.
|
|
732
898
|
|
|
733
899
|
| Symptom | Fix |
|
|
734
900
|
| --- | --- |
|
|
735
901
|
| `/tokens_*` is empty | Start OpenCode once so it creates `opencode.db`, then run a session with model usage. |
|
|
736
|
-
| Pricing looks stale | Run `/pricing_refresh
|
|
902
|
+
| Pricing looks stale | Run `/pricing_refresh` when the TUI plugin is installed. |
|
|
737
903
|
| Runtime pricing does not change output | Check `pricingSnapshot.source` in `opencode-quota/quota-toast.json`; `bundled` keeps packaged pricing active. |
|
|
738
|
-
| Cursor model has unknown pricing | Run `/pricing_refresh
|
|
904
|
+
| Cursor model has unknown pricing | Run `/pricing_refresh` when the TUI plugin is installed; Cursor `auto` and `composer*` use bundled deterministic pricing. |
|
|
739
905
|
|
|
740
906
|
</details>
|
|
741
907
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-quota.d.ts","sourceRoot":"","sources":["../../src/bin/opencode-quota.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"opencode-quota.d.ts","sourceRoot":"","sources":["../../src/bin/opencode-quota.ts"],"names":[],"mappings":";AAmCA,wBAAgB,gBAAgB,CAC9B,KAAK,GAAE,MAAM,GAAG,SAA2B,EAC3C,UAAU,GAAE,MAAuC,EACnD,WAAW,GAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAuB,GACzD,OAAO,CAMT;AAED,wBAAsB,IAAI,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BxE"}
|
|
@@ -6,13 +6,16 @@ import { runInitInstaller } from "../lib/init-installer.js";
|
|
|
6
6
|
const USAGE = [
|
|
7
7
|
"Usage:",
|
|
8
8
|
" npx @slkiser/opencode-quota init [--sync-legacy-config]",
|
|
9
|
-
" npx @slkiser/opencode-quota show [--provider <provider-id>]",
|
|
9
|
+
" npx @slkiser/opencode-quota show [--provider <provider-id>] [--json] [--threshold <pct>]",
|
|
10
10
|
" npx @slkiser/opencode-quota --help",
|
|
11
11
|
"",
|
|
12
12
|
"Commands:",
|
|
13
13
|
" init Run the interactive quota installer",
|
|
14
14
|
" --sync-legacy-config also writes experimental.quotaToast",
|
|
15
15
|
" show Print a quick quota glance",
|
|
16
|
+
" --json Machine-readable JSON output (reads from cache)",
|
|
17
|
+
" --threshold <pct> With --json, exit 1 if below <pct>%, 2 if no cached quota",
|
|
18
|
+
" --provider <id> Filter to one provider",
|
|
16
19
|
].join("\n");
|
|
17
20
|
function printUsage() {
|
|
18
21
|
console.log(USAGE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-quota.js","sourceRoot":"","sources":["../../src/bin/opencode-quota.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,2DAA2D;IAC3D
|
|
1
|
+
{"version":3,"file":"opencode-quota.js","sourceRoot":"","sources":["../../src/bin/opencode-quota.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,KAAK,GAAG;IACZ,QAAQ;IACR,2DAA2D;IAC3D,4FAA4F;IAC5F,sCAAsC;IACtC,EAAE;IACF,WAAW;IACX,+CAA+C;IAC/C,oEAAoE;IACpE,sCAAsC;IACtC,gFAAgF;IAChF,0FAA0F;IAC1F,uDAAuD;CACxD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,SAAS,UAAU;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,cAAc,CAAC,QAAgB;IACtC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAA4B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAC3C,aAAqB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EACnD,cAA4C,cAAc;IAE1D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,WAAW,CAAC,UAAU,CAAC,KAAK,WAAW,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEhC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACnE,UAAU,EAAE,CAAC;QACb,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,MAAM,gBAAgB,EAAE,CAAC;QAClC,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,sBAAsB,EAAE,CAAC;YAC5D,OAAO,MAAM,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACjE,OAAO,MAAM,iBAAiB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,UAAU,EAAE,CAAC;IACb,OAAO,CAAC,CAAC;AACX,CAAC;AAED,IAAI,gBAAgB,EAAE,EAAE,CAAC;IACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-show.d.ts","sourceRoot":"","sources":["../../src/lib/cli-show.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-show.d.ts","sourceRoot":"","sources":["../../src/lib/cli-show.ts"],"names":[],"mappings":"AAsBA,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC3C,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC5C;AA4ND,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyF/F"}
|