@slkiser/opencode-quota 3.8.8 → 3.10.0
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 +256 -70
- 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/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-config.d.ts +37 -0
- package/dist/lib/ollama-cloud-config.d.ts.map +1 -0
- package/dist/lib/ollama-cloud-config.js +148 -0
- package/dist/lib/ollama-cloud-config.js.map +1 -0
- package/dist/lib/ollama-cloud.d.ts +17 -0
- package/dist/lib/ollama-cloud.d.ts.map +1 -0
- package/dist/lib/ollama-cloud.js +150 -0
- package/dist/lib/ollama-cloud.js.map +1 -0
- 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/opencode-sqlite.d.ts.map +1 -1
- package/dist/lib/opencode-sqlite.js +90 -8
- package/dist/lib/opencode-sqlite.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 +9 -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 +677 -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 +48 -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 +104 -27
- package/dist/lib/tui-runtime.js.map +1 -1
- package/dist/lib/types.d.ts +35 -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/ollama-cloud.d.ts +9 -0
- package/dist/providers/ollama-cloud.d.ts.map +1 -0
- package/dist/providers/ollama-cloud.js +77 -0
- package/dist/providers/ollama-cloud.js.map +1 -0
- package/dist/providers/registry.js +2 -2
- package/dist/providers/registry.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.tsx +252 -1
- package/package.json +5 -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 |
|
|
@@ -201,27 +206,27 @@ For more examples, see [Common configuration](#common-configuration). For every
|
|
|
201
206
|
|
|
202
207
|
Most providers work automatically. If a provider has a “Needs setup” link, open that setup note only if you use that provider.
|
|
203
208
|
|
|
204
|
-
| Provider |
|
|
205
|
-
| --- | --- | --- |
|
|
206
|
-
| Anthropic (Claude) | [Needs setup](#anthropic-claude) | Local CLI
|
|
207
|
-
| GitHub Copilot |
|
|
208
|
-
| OpenAI | Automatic | Remote API |
|
|
209
|
-
| Cursor | [Needs setup](#cursor) | Local
|
|
210
|
-
| Qwen Code | [Needs setup](#qwen-code) | Local
|
|
211
|
-
| Alibaba Coding Plan |
|
|
212
|
-
| MiniMax Coding Plan |
|
|
213
|
-
| MiniMax Coding Plan (CN) |
|
|
214
|
-
| Kimi Code |
|
|
215
|
-
| Chutes AI |
|
|
216
|
-
|
|
|
217
|
-
|
|
|
218
|
-
|
|
|
219
|
-
|
|
|
220
|
-
|
|
|
221
|
-
|
|
|
222
|
-
|
|
|
223
|
-
|
|
|
224
|
-
| OpenCode Go | [Needs setup](#opencode-go) | Dashboard scraping |
|
|
209
|
+
| Provider | Auth/setup | Source | Reports |
|
|
210
|
+
| --- | --- | --- | --- |
|
|
211
|
+
| Anthropic (Claude) | [Needs setup](#anthropic-claude) | Local CLI/OAuth | Usage/quota |
|
|
212
|
+
| GitHub Copilot | OpenCode OAuth or PAT | Remote API | Quota/usage |
|
|
213
|
+
| OpenAI | Automatic | Remote API | Usage/quota |
|
|
214
|
+
| Cursor | [Needs setup](#cursor) | Local estimate | Estimated quota |
|
|
215
|
+
| Qwen Code | [Needs setup](#qwen-code) | Local estimate | Estimated quota |
|
|
216
|
+
| Alibaba Coding Plan | OpenCode config | Local estimate | Estimated quota |
|
|
217
|
+
| MiniMax Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
218
|
+
| MiniMax Coding Plan (CN) | OpenCode config | Remote API | Usage/quota |
|
|
219
|
+
| Kimi Code | OpenCode config | Remote API | Usage/quota |
|
|
220
|
+
| Chutes AI | API key/config | Remote API | Usage/quota |
|
|
221
|
+
| Synthetic | Automatic | Remote API | Quota |
|
|
222
|
+
| Google Antigravity | [Needs setup](#google-antigravity) | Remote API | Usage/quota |
|
|
223
|
+
| Gemini CLI | [Needs setup](#gemini-cli) | Remote API | Usage/quota |
|
|
224
|
+
| Z.ai Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
225
|
+
| Zhipu Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
226
|
+
| NanoGPT | API key/config | Remote APIs | Usage + balance |
|
|
227
|
+
| DeepSeek | API key/config | Remote API | Balance/status |
|
|
228
|
+
| Ollama Cloud | [Needs setup](#ollama-cloud) | Dashboard scraping | Dashboard usage |
|
|
229
|
+
| OpenCode Go | [Needs setup](#opencode-go) | Dashboard scraping | Dashboard usage |
|
|
225
230
|
|
|
226
231
|
## Common configuration
|
|
227
232
|
|
|
@@ -233,11 +238,11 @@ Common locations:
|
|
|
233
238
|
- Global install: usually `~/.config/opencode/opencode-quota/quota-toast.json`
|
|
234
239
|
- Custom config dir: `$OPENCODE_CONFIG_DIR/opencode-quota/quota-toast.json`
|
|
235
240
|
|
|
236
|
-
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.
|
|
237
242
|
|
|
238
243
|
### Maintainer announcements and privacy
|
|
239
244
|
|
|
240
|
-
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.
|
|
241
246
|
|
|
242
247
|
<details>
|
|
243
248
|
<summary><strong>Choose providers explicitly</strong></summary>
|
|
@@ -275,7 +280,7 @@ Announcements are bundled only: no remote fetches, announcement telemetry, or pe
|
|
|
275
280
|
<details>
|
|
276
281
|
<summary><strong>Turn off popup toasts</strong></summary>
|
|
277
282
|
|
|
278
|
-
Keeps
|
|
283
|
+
Keeps terminal checks, any enabled UI surfaces, and `/quota`/`/quota_status` when the TUI plugin is installed.
|
|
279
284
|
|
|
280
285
|
```jsonc
|
|
281
286
|
{
|
|
@@ -297,14 +302,14 @@ Keeps `/quota`, `/quota_status`, terminal checks, and any enabled UI surfaces.
|
|
|
297
302
|
}
|
|
298
303
|
```
|
|
299
304
|
|
|
300
|
-
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.
|
|
301
306
|
|
|
302
307
|
</details>
|
|
303
308
|
|
|
304
309
|
<details>
|
|
305
310
|
<summary><strong>Turn off the Sidebar panel</strong></summary>
|
|
306
311
|
|
|
307
|
-
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.
|
|
308
313
|
|
|
309
314
|
```jsonc
|
|
310
315
|
{
|
|
@@ -344,6 +349,21 @@ Useful when you want the compact line on the home screen but not in the chat/ses
|
|
|
344
349
|
|
|
345
350
|
</details>
|
|
346
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
|
+
|
|
347
367
|
<details>
|
|
348
368
|
<summary><strong>Advanced: legacy config sync</strong></summary>
|
|
349
369
|
|
|
@@ -370,22 +390,22 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
370
390
|
|
|
371
391
|
| Option | Default | Meaning |
|
|
372
392
|
| --- | --- | --- |
|
|
373
|
-
| `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. |
|
|
374
394
|
| `enabledProviders` | `"auto"` | Auto-detect providers, or set an explicit provider list. |
|
|
375
395
|
| `minIntervalMs` | `300000` | Minimum fetch interval between provider updates. |
|
|
376
396
|
| `requestTimeoutMs` | `5000` | Remote provider request timeout in milliseconds. |
|
|
377
|
-
| `formatStyle` | `singleWindow` | Shared quota reset-period display for popup toasts
|
|
378
|
-
| `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. |
|
|
379
399
|
| `onlyCurrentModel` | `false` | Filter quota rows to the current model/provider when that session selection can be resolved. |
|
|
380
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. |
|
|
381
|
-
| `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`. |
|
|
382
402
|
| `pricingSnapshot.autoRefresh` | `7` | Refresh stale local pricing data after this many days. |
|
|
383
403
|
|
|
384
404
|
### Toast settings
|
|
385
405
|
|
|
386
406
|
| Option | Default | Meaning |
|
|
387
407
|
| --- | --- | --- |
|
|
388
|
-
| `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. |
|
|
389
409
|
| `toastDurationMs` | `9000` | Toast duration in milliseconds. |
|
|
390
410
|
| `showOnIdle` | `true` | Show a toast on the idle trigger. |
|
|
391
411
|
| `showOnQuestion` | `true` | Show a toast after a question/assistant response. |
|
|
@@ -401,11 +421,13 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
401
421
|
| Option | Default | Meaning |
|
|
402
422
|
| --- | --- | --- |
|
|
403
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. |
|
|
404
425
|
| `tuiCompactStatus.enabled` | `false` | Opt in to Compact status line UI surfaces. |
|
|
405
426
|
| `tuiCompactStatus.homeBottom` | `true` | Show the Compact status line at the home bottom location. |
|
|
406
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. |
|
|
407
428
|
| `tuiCompactStatus.suppressWhenNativeProviderQuota` | `true` | Hide the Compact status line when OpenCode exposes native provider-quota support. |
|
|
408
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`. |
|
|
409
431
|
|
|
410
432
|
### Maintainer announcement settings
|
|
411
433
|
|
|
@@ -426,8 +448,152 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
426
448
|
| `cursorIncludedApiUsd` | unset | Override Cursor monthly included API budget in USD. |
|
|
427
449
|
| `cursorBillingCycleStartDay` | unset | Local billing-cycle anchor day `1..28`; when unset, Cursor usage resets on the local calendar month. |
|
|
428
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
|
+
|
|
429
458
|
</details>
|
|
430
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
|
+
|
|
431
597
|
## Provider setup notes
|
|
432
598
|
|
|
433
599
|
<a id="anthropic-claude"></a>
|
|
@@ -515,6 +681,25 @@ If you use manual provider selection, include `deepseek` in `enabledProviders`.
|
|
|
515
681
|
|
|
516
682
|
</details>
|
|
517
683
|
|
|
684
|
+
<a id="ollama-cloud"></a>
|
|
685
|
+
<details>
|
|
686
|
+
<summary><strong>Ollama Cloud</strong></summary>
|
|
687
|
+
|
|
688
|
+
Ollama Cloud quota scrapes the Ollama Cloud settings page and needs a `__Secure-session` cookie:
|
|
689
|
+
|
|
690
|
+
```bash
|
|
691
|
+
export OLLAMA_USAGE_COOKIE="your-session-cookie-value"
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
Or use one of these config files (cookie without the `__Secure-session=` prefix, or with — the plugin normalizes it):
|
|
695
|
+
|
|
696
|
+
- `~/.config/opencode/opencode-quota/ollama-cloud.json`: `{ "cookie": "..." }`
|
|
697
|
+
- `~/.config/ollama-usage/config.yaml`: `cookie: "..."`
|
|
698
|
+
|
|
699
|
+
To find the cookie, open `ollama.com/settings` in your browser, open Developer Tools → Storage → Cookies, and copy the value of `__Secure-session`.
|
|
700
|
+
|
|
701
|
+
</details>
|
|
702
|
+
|
|
518
703
|
<a id="opencode-go"></a>
|
|
519
704
|
<details>
|
|
520
705
|
<summary><strong>OpenCode Go</strong></summary>
|
|
@@ -534,7 +719,7 @@ Use `opencodeGoWindows` to choose **5h**, **Weekly**, and/or **Monthly** windows
|
|
|
534
719
|
|
|
535
720
|
Start here when quota or token data looks wrong.
|
|
536
721
|
|
|
537
|
-
1.
|
|
722
|
+
1. When the TUI plugin is installed, run `/quota_status`; otherwise start with `opencode-quota show` for a terminal quota summary.
|
|
538
723
|
2. Confirm the expected provider appears in the detected provider list.
|
|
539
724
|
3. Confirm companion auth plugins are before `@slkiser/opencode-quota` in `opencode.json`.
|
|
540
725
|
4. If token reports are empty, start OpenCode once so it creates `opencode.db`, then run a session with model usage.
|
|
@@ -544,28 +729,30 @@ Start here when quota or token data looks wrong.
|
|
|
544
729
|
|
|
545
730
|
| Symptom | Try this |
|
|
546
731
|
| --- | --- |
|
|
547
|
-
| `/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. |
|
|
548
734
|
| Sidebar panel does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, and check `tuiSidebarPanel.enabled`. |
|
|
549
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. |
|
|
550
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. |
|
|
551
737
|
| Popup toasts do not appear | Check `enableToast`, `showOnIdle`, `showOnQuestion`, and `showOnCompact`. |
|
|
552
|
-
| 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`. |
|
|
553
739
|
| Token reports are empty | Start OpenCode once so `opencode.db` exists, then run a session with model usage. |
|
|
554
|
-
| 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. |
|
|
555
742
|
|
|
556
743
|
### Provider troubleshooting
|
|
557
744
|
|
|
558
745
|
<details>
|
|
559
746
|
<summary><strong>Anthropic (Claude)</strong></summary>
|
|
560
747
|
|
|
561
|
-
|
|
748
|
+
When the TUI plugin is installed, run `/quota_status` and check the Anthropic section.
|
|
562
749
|
|
|
563
750
|
| Symptom | Fix |
|
|
564
751
|
| --- | --- |
|
|
565
752
|
| `claude` not found | Install Claude Code and make sure `claude` is on your `PATH`. |
|
|
566
753
|
| Claude is installed at a custom path | Set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`. |
|
|
567
754
|
| Not authenticated | Run `claude auth login`, then confirm `claude auth status` works. |
|
|
568
|
-
| 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. |
|
|
569
756
|
| Provider not detected | Confirm OpenCode is configured to use the `anthropic` provider. |
|
|
570
757
|
|
|
571
758
|
</details>
|
|
@@ -573,7 +760,7 @@ Run `/quota_status` and check the Anthropic section.
|
|
|
573
760
|
<details>
|
|
574
761
|
<summary><strong>GitHub Copilot</strong></summary>
|
|
575
762
|
|
|
576
|
-
|
|
763
|
+
When the TUI plugin is installed, run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_scope`, and `quota_api`.
|
|
577
764
|
|
|
578
765
|
| Symptom | Fix |
|
|
579
766
|
| --- | --- |
|
|
@@ -587,7 +774,7 @@ Run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_sco
|
|
|
587
774
|
<details>
|
|
588
775
|
<summary><strong>OpenAI</strong></summary>
|
|
589
776
|
|
|
590
|
-
|
|
777
|
+
When the TUI plugin is installed, run `/quota_status` and check the OpenAI auth source and token status.
|
|
591
778
|
|
|
592
779
|
| Symptom | Fix |
|
|
593
780
|
| --- | --- |
|
|
@@ -600,7 +787,7 @@ Run `/quota_status` and check the OpenAI auth source and token status.
|
|
|
600
787
|
<details>
|
|
601
788
|
<summary><strong>Cursor</strong></summary>
|
|
602
789
|
|
|
603
|
-
|
|
790
|
+
When the TUI plugin is installed, run `/quota_status` and check the Cursor section.
|
|
604
791
|
|
|
605
792
|
| Symptom | Fix |
|
|
606
793
|
| --- | --- |
|
|
@@ -608,42 +795,42 @@ Run `/quota_status` and check the Cursor section.
|
|
|
608
795
|
| Cursor auth missing | Run `opencode auth login --provider cursor`. |
|
|
609
796
|
| Quota appears but no remaining percentage | Set `cursorPlan` or `cursorIncludedApiUsd` in `opencode-quota/quota-toast.json`. |
|
|
610
797
|
| Billing cycle looks wrong | Set `cursorBillingCycleStartDay` in `opencode-quota/quota-toast.json` to your local billing anchor day. |
|
|
611
|
-
| 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. |
|
|
612
799
|
|
|
613
800
|
</details>
|
|
614
801
|
|
|
615
802
|
<details>
|
|
616
803
|
<summary><strong>Qwen Code</strong></summary>
|
|
617
804
|
|
|
618
|
-
|
|
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.
|
|
619
806
|
|
|
620
807
|
| Symptom | Fix |
|
|
621
808
|
| --- | --- |
|
|
622
809
|
| Qwen not detected | Put `opencode-qwencode-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
623
810
|
| Auth missing | Complete the Qwen companion plugin auth flow. |
|
|
624
811
|
| Counters do not move | Confirm the current model is `qwen-code/*`; Qwen quota is local request estimation for matching model usage. |
|
|
625
|
-
| Usage looks stale |
|
|
812
|
+
| Usage looks stale | When the TUI plugin is installed, check the local state file path shown by `/quota_status`. |
|
|
626
813
|
|
|
627
814
|
</details>
|
|
628
815
|
|
|
629
816
|
<details>
|
|
630
817
|
<summary><strong>Alibaba Coding Plan</strong></summary>
|
|
631
818
|
|
|
632
|
-
|
|
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.
|
|
633
820
|
|
|
634
821
|
| Symptom | Fix |
|
|
635
822
|
| --- | --- |
|
|
636
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. |
|
|
637
824
|
| Wrong tier | Set `alibabaCodingPlanTier` to `lite` or `pro` in `opencode-quota/quota-toast.json`. |
|
|
638
825
|
| Counters do not move | Confirm the current model is `alibaba/*` or `alibaba-cn/*`. |
|
|
639
|
-
| Quota seems stale |
|
|
826
|
+
| Quota seems stale | When the TUI plugin is installed, check the state-file path shown in `/quota_status`. |
|
|
640
827
|
|
|
641
828
|
</details>
|
|
642
829
|
|
|
643
830
|
<details>
|
|
644
|
-
<summary><strong>MiniMax, Kimi, Chutes AI,
|
|
831
|
+
<summary><strong>MiniMax, Kimi, Chutes AI, Synthetic, Z.ai, Zhipu, NanoGPT, and DeepSeek</strong></summary>
|
|
645
832
|
|
|
646
|
-
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.
|
|
647
834
|
|
|
648
835
|
| Provider | Useful checks |
|
|
649
836
|
| --- | --- |
|
|
@@ -651,7 +838,6 @@ These providers use trusted env vars, trusted user/global OpenCode config, or na
|
|
|
651
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. |
|
|
652
839
|
| Kimi Code | Use `KIMI_API_KEY` or `KIMI_CODE_API_KEY`; repo-local provider secrets are ignored. |
|
|
653
840
|
| Chutes AI | Use `CHUTES_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
654
|
-
| Crof.ai | Use `CROF_API_KEY`, `CROFAI_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
655
841
|
| Synthetic | Use `SYNTHETIC_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
656
842
|
| Z.ai Coding Plan | Use `ZAI_API_KEY` or `ZAI_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
657
843
|
| Zhipu Coding Plan | Use `ZHIPU_API_KEY` or `ZHIPU_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
@@ -665,21 +851,21 @@ For security, repo-local `opencode.json` / `opencode.jsonc` is ignored for provi
|
|
|
665
851
|
<details>
|
|
666
852
|
<summary><strong>Google Antigravity</strong></summary>
|
|
667
853
|
|
|
668
|
-
|
|
854
|
+
When the TUI plugin is installed, run `/quota_status` and check the `google_antigravity` section.
|
|
669
855
|
|
|
670
856
|
| Symptom | Fix |
|
|
671
857
|
| --- | --- |
|
|
672
858
|
| Companion missing | Put `opencode-antigravity-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
673
|
-
| Accounts not found |
|
|
859
|
+
| Accounts not found | When the TUI plugin is installed, check the selected `antigravity-accounts.json` path shown by `/quota_status`. |
|
|
674
860
|
| Refresh tokens invalid | Re-authenticate with the companion plugin. |
|
|
675
|
-
| 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`. |
|
|
676
862
|
|
|
677
863
|
</details>
|
|
678
864
|
|
|
679
865
|
<details>
|
|
680
866
|
<summary><strong>Gemini CLI</strong></summary>
|
|
681
867
|
|
|
682
|
-
|
|
868
|
+
When the TUI plugin is installed, run `/quota_status` and check the Gemini CLI live probe rows.
|
|
683
869
|
|
|
684
870
|
| Symptom | Fix |
|
|
685
871
|
| --- | --- |
|
|
@@ -693,14 +879,14 @@ Run `/quota_status` and check the Gemini CLI live probe rows.
|
|
|
693
879
|
<details>
|
|
694
880
|
<summary><strong>OpenCode Go</strong></summary>
|
|
695
881
|
|
|
696
|
-
|
|
882
|
+
When the TUI plugin is installed, run `/quota_status` and check the `opencode_go` section.
|
|
697
883
|
|
|
698
884
|
| Symptom | Fix |
|
|
699
885
|
| --- | --- |
|
|
700
|
-
| 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. |
|
|
701
887
|
| Incomplete config | `workspaceId` and `authCookie` must come from the same source. |
|
|
702
888
|
| Scrape returns no data | Refresh the browser `auth` cookie from `opencode.ai`. |
|
|
703
|
-
| 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. |
|
|
704
890
|
| Dashboard format changed | This integration scrapes the dashboard, so it can break if the dashboard markup changes. |
|
|
705
891
|
|
|
706
892
|
</details>
|
|
@@ -708,14 +894,14 @@ Run `/quota_status` and check the `opencode_go` section.
|
|
|
708
894
|
<details>
|
|
709
895
|
<summary><strong>Token reports</strong></summary>
|
|
710
896
|
|
|
711
|
-
|
|
897
|
+
When the TUI plugin is installed, run `/quota_status` and check pricing snapshot health plus OpenCode database paths.
|
|
712
898
|
|
|
713
899
|
| Symptom | Fix |
|
|
714
900
|
| --- | --- |
|
|
715
901
|
| `/tokens_*` is empty | Start OpenCode once so it creates `opencode.db`, then run a session with model usage. |
|
|
716
|
-
| Pricing looks stale | Run `/pricing_refresh
|
|
902
|
+
| Pricing looks stale | Run `/pricing_refresh` when the TUI plugin is installed. |
|
|
717
903
|
| Runtime pricing does not change output | Check `pricingSnapshot.source` in `opencode-quota/quota-toast.json`; `bundled` keeps packaged pricing active. |
|
|
718
|
-
| 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. |
|
|
719
905
|
|
|
720
906
|
</details>
|
|
721
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);
|