@slkiser/opencode-quota 3.10.1 → 3.11.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.
Files changed (62) hide show
  1. package/README.md +57 -815
  2. package/dist/lib/config.js +1 -1
  3. package/dist/lib/config.js.map +1 -1
  4. package/dist/lib/entries.d.ts +5 -0
  5. package/dist/lib/entries.d.ts.map +1 -1
  6. package/dist/lib/google-agy-companion.d.ts +29 -0
  7. package/dist/lib/google-agy-companion.d.ts.map +1 -0
  8. package/dist/lib/google-agy-companion.js +289 -0
  9. package/dist/lib/google-agy-companion.js.map +1 -0
  10. package/dist/lib/google-agy.d.ts +52 -0
  11. package/dist/lib/google-agy.d.ts.map +1 -0
  12. package/dist/lib/google-agy.js +461 -0
  13. package/dist/lib/google-agy.js.map +1 -0
  14. package/dist/lib/google-antigravity-companion.d.ts.map +1 -1
  15. package/dist/lib/google-antigravity-companion.js +3 -1
  16. package/dist/lib/google-antigravity-companion.js.map +1 -1
  17. package/dist/lib/google-gemini-cli.js +4 -4
  18. package/dist/lib/google-gemini-cli.js.map +1 -1
  19. package/dist/lib/google.d.ts.map +1 -1
  20. package/dist/lib/google.js +55 -5
  21. package/dist/lib/google.js.map +1 -1
  22. package/dist/lib/grouped-entry-normalization.js +1 -1
  23. package/dist/lib/grouped-entry-normalization.js.map +1 -1
  24. package/dist/lib/init-installer.js +3 -3
  25. package/dist/lib/init-installer.js.map +1 -1
  26. package/dist/lib/maintainer-announcements.js +2 -2
  27. package/dist/lib/maintainer-announcements.js.map +1 -1
  28. package/dist/lib/provider-metadata.d.ts +1 -1
  29. package/dist/lib/provider-metadata.d.ts.map +1 -1
  30. package/dist/lib/provider-metadata.js +15 -0
  31. package/dist/lib/provider-metadata.js.map +1 -1
  32. package/dist/lib/quota-dialog-commands.js +1 -1
  33. package/dist/lib/quota-dialog-commands.js.map +1 -1
  34. package/dist/lib/quota-render-data.d.ts.map +1 -1
  35. package/dist/lib/quota-render-data.js +13 -0
  36. package/dist/lib/quota-render-data.js.map +1 -1
  37. package/dist/lib/quota-status.d.ts +1 -0
  38. package/dist/lib/quota-status.d.ts.map +1 -1
  39. package/dist/lib/quota-status.js +29 -0
  40. package/dist/lib/quota-status.js.map +1 -1
  41. package/dist/lib/toast-format-grouped.js +1 -1
  42. package/dist/lib/toast-format-grouped.js.map +1 -1
  43. package/dist/lib/tui-runtime.js +2 -2
  44. package/dist/lib/tui-runtime.js.map +1 -1
  45. package/dist/lib/types.d.ts +22 -1
  46. package/dist/lib/types.d.ts.map +1 -1
  47. package/dist/lib/types.js +12 -3
  48. package/dist/lib/types.js.map +1 -1
  49. package/dist/plugin.d.ts.map +1 -1
  50. package/dist/plugin.js +42 -4
  51. package/dist/plugin.js.map +1 -1
  52. package/dist/providers/google-agy.d.ts +3 -0
  53. package/dist/providers/google-agy.d.ts.map +1 -0
  54. package/dist/providers/google-agy.js +90 -0
  55. package/dist/providers/google-agy.js.map +1 -0
  56. package/dist/providers/google-antigravity.d.ts.map +1 -1
  57. package/dist/providers/google-antigravity.js +3 -1
  58. package/dist/providers/google-antigravity.js.map +1 -1
  59. package/dist/providers/registry.d.ts.map +1 -1
  60. package/dist/providers/registry.js +2 -0
  61. package/dist/providers/registry.js.map +1 -1
  62. package/package.json +2 -2
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  </picture>
8
8
  </a>
9
9
  </p>
10
- <p align="center">Quota, usage, and token visibility for OpenCode.</p>
10
+ <p align="center">Quota, usage, and token visibility for OpenCode and CLI.</p>
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/@slkiser/opencode-quota"><img alt="npm" src="https://img.shields.io/npm/v/%40slkiser%2Fopencode-quota?style=flat-square" /></a>
13
13
  <a href="https://www.npmjs.com/package/@slkiser/opencode-quota"><img alt="npm downloads" src="https://img.shields.io/npm/dm/%40slkiser%2Fopencode-quota?style=flat-square" /></a>
@@ -19,7 +19,7 @@
19
19
 
20
20
  ---
21
21
 
22
- ## Install
22
+ ## Quick start
23
23
 
24
24
  ```bash
25
25
  npx @slkiser/opencode-quota init
@@ -28,52 +28,14 @@ npx @slkiser/opencode-quota init
28
28
  > [!IMPORTANT]
29
29
  > OpenCode `>= 1.4.3` and Node.js `>= 20` are required.
30
30
 
31
- The installer adds missing plugin/config entries and keeps your unrelated settings. Re-running it updates only installer-owned Quota UI choices.
32
-
33
- ### What the installer asks
34
-
35
- | Question | Pick this when you want... |
36
- | --- | --- |
37
- | Install scope | This repo/worktree only, or your global OpenCode config. |
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
- | Provider mode | Auto-detect providers, or choose a provider list yourself. |
40
- | Quota reset periods | Show one reset period per provider, or all known reset periods. |
41
- | Quota percentage meaning | Show quota remaining, or quota already used. |
42
- | Session token details | Hide token counts for shorter output, or show them when available. |
43
- | Maintainer announcements | Keep bundled maintainer announcements enabled, or opt out. Yes is the default; Sidebar or Compact status installs the TUI plugin, where home notices can appear. |
44
-
45
- ### After install
46
-
47
31
  1. Restart OpenCode.
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
- 5. If you enabled the Sidebar panel, open the session sidebar and look for `Quota`.
52
- 6. If you enabled Compact status line, look for the home-bottom quota line and the chat/session prompt quota line.
53
-
54
- ### Terminal-only check
55
-
56
- Run without installing the binary first:
57
-
58
- ```bash
59
- npx @slkiser/opencode-quota show
60
- ```
61
-
62
- Or, if `opencode-quota` is already on your `PATH`:
63
-
64
- ```bash
65
- opencode-quota show --provider copilot
66
- ```
32
+ 2. Run `/quota` in OpenCode, or use `opencode-quota show` from your terminal.
33
+ 3. If you enabled the Sidebar panel, open the session sidebar and look for `Quota`.
34
+ 4. If you enabled Compact status line, look for the home-bottom quota line and the chat/session prompt quota line.
35
+ 5. If something looks wrong, run `/quota_status` in OpenCode or see [Troubleshooting](docs/readme/troubleshooting.md).
67
36
 
68
37
  ## What you get
69
38
 
70
- - A `Quota` Sidebar panel in the TUI
71
- - Popup quota toasts in OpenCode
72
- - A Compact status line in the TUI
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
- - Provider diagnostics for auth, quota sources, pricing, and bundled maintainer announcements
76
-
77
39
  <table>
78
40
  <tr>
79
41
  <td width="50%">
@@ -84,8 +46,8 @@ opencode-quota show --provider copilot
84
46
  </td>
85
47
  </tr>
86
48
  <tr>
87
- <td width="50%" align="center">Sidebar panel</td>
88
- <td width="50%" align="center">Toast</td>
49
+ <td width="50%" align="center"><strong>Sidebar panel</strong><br />A full quota view in OpenCode's session sidebar.</td>
50
+ <td width="50%" align="center"><strong>Toast</strong><br />Popup quota checks after idle, question, or compact events.</td>
89
51
  </tr>
90
52
  <tr>
91
53
  <td width="50%">
@@ -96,111 +58,47 @@ opencode-quota show --provider copilot
96
58
  </td>
97
59
  </tr>
98
60
  <tr>
99
- <td width="50%" align="center">Compact status line</td>
100
- <td width="50%" align="center"><code>/tokens_weekly</code> TUI report</td>
61
+ <td width="50%" align="center"><strong>Compact status line</strong><br />Short quota text on home and chat/session prompt surfaces.</td>
62
+ <td width="50%" align="center"><strong>Token reports</strong><br /><code>/tokens_today</code>, <code>/tokens_weekly</code>, session reports, and more.</td>
101
63
  </tr>
102
64
  </table>
103
65
 
104
- ## Manual setup
105
-
106
- Use the installer when possible. For manual setup, use the same OpenCode config location you would pick in the installer:
107
-
108
- - **Project install:** files live in your repo/worktree.
109
- - **Global install:** files live in your OpenCode config directory, usually `~/.config/opencode`.
110
- - If you set `OPENCODE_CONFIG_DIR`, use that directory instead.
111
-
112
- ### 1. Add the server plugin (required)
113
-
114
- This enables providers, terminal checks, popup toasts, and the `tool.quota_status` tool. Add this to `opencode.json` or `opencode.jsonc`:
115
-
116
- ```jsonc
117
- {
118
- "$schema": "https://opencode.ai/config.json",
119
- "plugin": ["@slkiser/opencode-quota"],
120
- }
121
- ```
122
-
123
- ### 2. Add the TUI plugin (for dialog slash commands and TUI surfaces)
124
-
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
-
127
- ```jsonc
128
- {
129
- "$schema": "https://opencode.ai/tui.json",
130
- "plugin": ["@slkiser/opencode-quota"],
131
- }
132
- ```
133
-
134
- ### 3. Add quota settings
135
-
136
- Create or edit `opencode-quota/quota-toast.json` **next to the `opencode.json` / `tui.json` file above**. For a project install, that means:
137
-
138
- ```text
139
- <your-repo>/opencode-quota/quota-toast.json
140
- ```
141
-
142
- Start with this, then adjust the UI choices in the next section:
143
-
144
- ```jsonc
145
- {
146
- "enabledProviders": "auto",
147
- "enableToast": true,
148
- "tuiSidebarPanel": {
149
- "enabled": true,
150
- },
151
- "tuiCompactStatus": {
152
- "enabled": false,
153
- },
154
- "maintainerAnnouncements": {
155
- "enabled": true,
156
- "home": true,
157
- },
158
- }
159
- ```
160
-
161
- > [!TIP]
162
- > When the TUI plugin is installed, run `/quota_status` to see the exact config paths OpenCode Quota loaded.
66
+ More ways to use it:
163
67
 
164
- ## Choose your UI surfaces
165
-
166
- All UI surfaces use the same quota data. Put these settings in `opencode-quota/quota-toast.json`, not `tui.json`.
167
-
168
- | UI surface | Config | Notes |
169
- | --- | --- | --- |
170
- | Sidebar panel | `tuiSidebarPanel.enabled: true` | Full `Quota` panel in OpenCode's session sidebar. Requires the TUI plugin entry above. |
171
- | Toast | `enableToast: true` | Popup toast after idle/question/compact events. Requires the server plugin entry above. |
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
- | 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
- | 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. |
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`.
178
-
179
- In the sidebar panel, click the `Quota` header to switch between the compact summary (`▶ Quota`) and the detailed all-windows view (`▼ Quota`). OpenCode remembers the last sidebar state for the plugin.
68
+ - Terminal checks with `opencode-quota show` before or without opening OpenCode
69
+ - JSON output for scripts, status bars, CI checks, and external tools
70
+ - Local TUI dialogs for slash commands when the TUI plugin is installed
71
+ - Provider diagnostics for auth, quota sources, pricing, and bundled maintainer announcements
180
72
 
181
- For more examples, see [Common configuration](#common-configuration). For every option, see [Full configuration reference](#full-configuration-reference).
73
+ See [Configuration](docs/readme/configuration.md) for UI options and [Manual install](docs/readme/manual-install.md) for setup details.
182
74
 
183
75
  ## Commands
184
76
 
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.
77
+ ### Core slash commands
186
78
 
187
- | Command | What it shows |
79
+ | Command | Use when |
188
80
  | --- | --- |
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 |
192
- | `/quota` | Detailed quota report |
193
- | `/quota_status` | Config, provider, auth, pricing, `enabled`/`home` announcement config, `source=bundled_only`, `network=false`, and active/future/expired announcement counts |
194
- | `/quota_announcements` | List active bundled maintainer notices |
81
+ | `/quota` | Show your quota and usage details |
82
+ | `/quota_status` | Diagnose setup, auth, provider detection, pricing, and announcements |
83
+ | `/quota_announcements` | Read active bundled maintainer notices |
195
84
  | `/pricing_refresh` | Refresh local runtime pricing from `models.dev` |
196
- | `/tokens_today` | Tokens used today |
197
- | `/tokens_daily` | Tokens used in the last 24 hours |
198
- | `/tokens_weekly` | Tokens used in the last 7 days |
199
- | `/tokens_monthly` | Tokens used in the last 30 days, including pricing |
200
- | `/tokens_all` | Tokens used across all local history |
201
- | `/tokens_session` | Tokens used in the current session |
202
- | `/tokens_session_all` | Current session plus descendant sessions |
203
- | `/tokens_between` | Tokens used between `YYYY-MM-DD YYYY-MM-DD` |
85
+ | `/tokens_today` | Show tokens used today |
86
+ | `/tokens_daily` | Show tokens used in the last 24 hours |
87
+ | `/tokens_weekly` | Show tokens used in the last 7 days |
88
+ | `/tokens_monthly` | Show tokens used in the last 30 days, including pricing |
89
+ | `/tokens_all` | Show tokens used across all local history |
90
+ | `/tokens_session` | Show tokens used in the current session |
91
+ | `/tokens_session_all` | Show current session plus descendant sessions |
92
+ | `/tokens_between YYYY-MM-DD YYYY-MM-DD` | Show tokens used between two dates |
93
+
94
+ ### CLI commands
95
+
96
+ | Command | Use when |
97
+ | --- | --- |
98
+ | `opencode-quota show` | Check quota from your terminal |
99
+ | `opencode-quota show --provider <id>` | Check one provider only, such as `copilot` or `openai` |
100
+ | `opencode-quota show --json` | Print JSON for scripts, status bars, and other tools |
101
+ | `opencode-quota show --json --threshold <pct>` | Fail the command when cached quota drops below your chosen percentage |
204
102
 
205
103
  ## Providers
206
104
 
@@ -208,702 +106,46 @@ Most providers work automatically. If a provider has a “Needs setup” link, o
208
106
 
209
107
  | Provider | Auth/setup | Source | Reports |
210
108
  | --- | --- | --- | --- |
211
- | Anthropic (Claude) | [Needs setup](#anthropic-claude) | Local CLI/OAuth | Usage/quota |
109
+ | Anthropic (Claude) | [Needs setup](docs/readme/providers.md#anthropic-claude) | Local CLI/OAuth | Usage/quota |
212
110
  | GitHub Copilot | OpenCode OAuth or PAT | Remote API | Quota/usage |
213
111
  | 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 |
112
+ | Cursor | [Needs setup](docs/readme/providers.md#cursor) | Local estimate | Estimated quota |
113
+ | Qwen Code | [Needs setup](docs/readme/providers.md#qwen-code) | Local estimate | Estimated quota |
216
114
  | Alibaba Coding Plan | OpenCode config | Local estimate | Estimated quota |
217
115
  | MiniMax Coding Plan | OpenCode config | Remote API | Usage/quota |
218
116
  | MiniMax Coding Plan (CN) | OpenCode config | Remote API | Usage/quota |
219
117
  | Kimi Code | OpenCode config | Remote API | Usage/quota |
220
118
  | Chutes AI | API key/config | Remote API | Usage/quota |
221
119
  | 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 |
120
+ | Google Antigravity | [Needs setup](docs/readme/providers.md#google-antigravity) | Remote API | Usage/quota |
121
+ | Google AGY | [Needs setup](docs/readme/providers.md#google-agy-quick-setup) | Remote API | Usage/quota |
122
+ | Gemini CLI | [Needs setup](docs/readme/providers.md#gemini-cli) | Remote API | Usage/quota |
224
123
  | Z.ai Coding Plan | OpenCode config | Remote API | Usage/quota |
225
124
  | Zhipu Coding Plan | OpenCode config | Remote API | Usage/quota |
226
- | NanoGPT | API key/config | Remote APIs | Usage + balance |
125
+ | NanoGPT | API key/config | Remote API | Usage + balance |
227
126
  | 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 |
230
-
231
- ## Common configuration
232
-
233
- Customize these settings in `opencode-quota/quota-toast.json`, next to the OpenCode config for your install scope.
234
-
235
- Common locations:
236
-
237
- - Project install: `<your-repo>/opencode-quota/quota-toast.json`
238
- - Global install: usually `~/.config/opencode/opencode-quota/quota-toast.json`
239
- - Custom config dir: `$OPENCODE_CONFIG_DIR/opencode-quota/quota-toast.json`
240
-
241
- If you are unsure and the TUI plugin is installed, run `/quota_status`; otherwise check the install-scope paths above.
242
-
243
- ### Maintainer announcements and privacy
244
-
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.
246
-
247
- <details>
248
- <summary><strong>Choose providers explicitly</strong></summary>
249
-
250
- ```jsonc
251
- {
252
- "enabledProviders": ["copilot", "openai", "google-gemini-cli"],
253
- }
254
- ```
127
+ | Ollama Cloud | [Needs setup](docs/readme/providers.md#ollama-cloud) | Dashboard scraping | Dashboard usage |
128
+ | OpenCode Go | [Needs setup](docs/readme/providers.md#opencode-go) | Dashboard scraping | Dashboard usage |
255
129
 
256
- </details>
257
-
258
- <details>
259
- <summary><strong>Show all quota reset periods</strong></summary>
260
-
261
- ```jsonc
262
- {
263
- "formatStyle": "allWindows",
264
- }
265
- ```
266
-
267
- </details>
268
-
269
- <details>
270
- <summary><strong>Show used percentages</strong></summary>
271
-
272
- ```jsonc
273
- {
274
- "percentDisplayMode": "used",
275
- }
276
- ```
277
-
278
- </details>
279
-
280
- <details>
281
- <summary><strong>Turn off popup toasts</strong></summary>
282
-
283
- Keeps terminal checks, any enabled UI surfaces, and `/quota`/`/quota_status` when the TUI plugin is installed.
284
-
285
- ```jsonc
286
- {
287
- "enableToast": false,
288
- }
289
- ```
290
-
291
- </details>
292
-
293
- <details>
294
- <summary><strong>Configure maintainer announcements</strong></summary>
295
-
296
- ```jsonc
297
- {
298
- "maintainerAnnouncements": {
299
- "enabled": true,
300
- "home": true,
301
- },
302
- }
303
- ```
304
-
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.
306
-
307
- </details>
308
-
309
- <details>
310
- <summary><strong>Turn off the Sidebar panel</strong></summary>
311
-
312
- Useful when you want Compact status line only, toasts only, or installed TUI slash dialogs without the Sidebar panel.
313
-
314
- ```jsonc
315
- {
316
- "tuiSidebarPanel": {
317
- "enabled": false,
318
- },
319
- }
320
- ```
321
-
322
- </details>
323
-
324
- <details>
325
- <summary><strong>Keep Compact status line on home only</strong></summary>
326
-
327
- Useful when you want the compact line on the home screen but not in the chat/session prompt area.
328
-
329
- ```jsonc
330
- {
331
- "tuiCompactStatus": {
332
- "enabled": true,
333
- "homeBottom": true,
334
- "sessionPrompt": false,
335
- },
336
- }
337
- ```
338
-
339
- </details>
340
-
341
- <details>
342
- <summary><strong>Increase provider request timeout</strong></summary>
343
-
344
- ```jsonc
345
- {
346
- "requestTimeoutMs": 12000,
347
- }
348
- ```
349
-
350
- </details>
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
-
367
- <details>
368
- <summary><strong>Advanced: legacy config sync</strong></summary>
369
-
370
- By default, the installer writes quota settings only to `opencode-quota/quota-toast.json`. If you also want it to write the legacy OpenCode block, run:
371
-
372
- ```bash
373
- npx @slkiser/opencode-quota init --sync-legacy-config
374
- ```
375
-
376
- This is only for users who intentionally want `experimental.quotaToast` mirrored into `opencode.json` / `opencode.jsonc`.
377
-
378
- </details>
379
-
380
- ## Full configuration reference
381
-
382
- Settings go in the same `opencode-quota/quota-toast.json` sidecar described above.
383
-
384
- Existing `experimental.quotaToast` settings still work when no sidecar file exists. Quota settings do not live in `tui.json`.
385
-
386
- <details>
387
- <summary><strong>All settings</strong></summary>
388
-
389
- ### Core/shared settings
390
-
391
- | Option | Default | Meaning |
392
- | --- | --- | --- |
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. |
394
- | `enabledProviders` | `"auto"` | Auto-detect providers, or set an explicit provider list. |
395
- | `minIntervalMs` | `300000` | Minimum fetch interval between provider updates. |
396
- | `requestTimeoutMs` | `5000` | Remote provider request timeout in milliseconds. |
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. |
399
- | `onlyCurrentModel` | `false` | Filter quota rows to the current model/provider when that session selection can be resolved. |
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. |
401
- | `pricingSnapshot.source` | `"auto"` | Token pricing snapshot selection for `/tokens_*` when the TUI plugin is installed: `auto`, `bundled`, or `runtime`. |
402
- | `pricingSnapshot.autoRefresh` | `7` | Refresh stale local pricing data after this many days. |
403
-
404
- ### Toast settings
405
-
406
- | Option | Default | Meaning |
407
- | --- | --- | --- |
408
- | `enableToast` | `true` | Show popup toasts. Disabling this does not disable terminal checks, UI surfaces, or `/quota` when the TUI plugin is installed. |
409
- | `toastDurationMs` | `9000` | Toast duration in milliseconds. |
410
- | `showOnIdle` | `true` | Show a toast on the idle trigger. |
411
- | `showOnQuestion` | `true` | Show a toast after a question/assistant response. |
412
- | `showOnCompact` | `true` | Show a toast after session compaction. |
413
- | `showOnBothFail` | `true` | Show a fallback toast when providers attempted quota reads and all failed. |
414
- | `layout.maxWidth` | `50` | Toast formatting width target. |
415
- | `layout.narrowAt` | `42` | Toast compact-layout breakpoint. |
416
- | `layout.tinyAt` | `32` | Toast tiny-layout breakpoint. |
417
- | `debug` | `false` | Append toast debug context when troubleshooting. |
418
-
419
- ### TUI settings
420
-
421
- | Option | Default | Meaning |
422
- | --- | --- | --- |
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. |
425
- | `tuiCompactStatus.enabled` | `false` | Opt in to Compact status line UI surfaces. |
426
- | `tuiCompactStatus.homeBottom` | `true` | Show the Compact status line at the home bottom location. |
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. |
428
- | `tuiCompactStatus.suppressWhenNativeProviderQuota` | `true` | Hide the Compact status line when OpenCode exposes native provider-quota support. |
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`. |
431
-
432
- ### Maintainer announcement settings
433
-
434
- | Option | Default | Meaning |
435
- | --- | --- | --- |
436
- | `maintainerAnnouncements.enabled` | `true` | Enable bundled maintainer announcements. |
437
- | `maintainerAnnouncements.home` | `true` | Show the count-only notice on TUI home when the quota TUI plugin is configured, or as a one-shot toast fallback after a visible quota toast when it is not. |
438
-
439
- ### Provider-specific settings
440
-
441
- | Option | Default | Meaning |
442
- | --- | --- | --- |
443
- | `anthropicBinaryPath` | `"claude"` | Command/path used for local Claude CLI probing. |
444
- | `googleModels` | `["CLAUDE"]` | Google model keys to query: `CLAUDE`, `G3PRO`, `G3FLASH`, `G3IMAGE`. |
445
- | `opencodeGoWindows` | `["rolling", "weekly", "monthly"]` | OpenCode Go usage windows to display. |
446
- | `alibabaCodingPlanTier` | `"lite"` | Fallback Alibaba Coding Plan tier when auth does not include `tier`. |
447
- | `cursorPlan` | `"none"` | Cursor included API budget preset: `none`, `pro`, `pro-plus`, `ultra`. |
448
- | `cursorIncludedApiUsd` | unset | Override Cursor monthly included API budget in USD. |
449
- | `cursorBillingCycleStartDay` | unset | Local billing-cycle anchor day `1..28`; when unset, Cursor usage resets on the local calendar month. |
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
-
458
- </details>
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
-
597
- ## Provider setup notes
598
-
599
- <a id="anthropic-claude"></a>
600
- <details>
601
- <summary><strong>Anthropic (Claude)</strong></summary>
602
-
603
- Install Claude Code, authenticate it, and make sure `claude` is on your `PATH`:
604
-
605
- ```bash
606
- claude auth login
607
- claude auth status
608
- ```
609
-
610
- If Claude lives at a custom path, set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`.
611
-
612
- </details>
613
-
614
- <a id="cursor"></a>
615
- <details>
616
- <summary><strong>Cursor</strong></summary>
617
-
618
- Use companion plugin [`@playwo/opencode-cursor-oauth`](https://github.com/PoolPirate/opencode-cursor#readme). Add it before `@slkiser/opencode-quota` in `opencode.json`, then authenticate once:
619
-
620
- ```bash
621
- opencode auth login --provider cursor
622
- ```
623
-
624
- </details>
625
-
626
- <a id="qwen-code"></a>
627
- <details>
628
- <summary><strong>Qwen Code</strong></summary>
629
-
630
- Use companion plugin [`opencode-qwencode-auth`](https://github.com/gustavodiasdev/opencode-qwencode-auth#readme). Add it before `@slkiser/opencode-quota` in `opencode.json`.
631
-
632
- </details>
633
-
634
- <a id="google-antigravity"></a>
635
- <details>
636
- <summary><strong>Google Antigravity</strong></summary>
637
-
638
- Use companion plugin [`opencode-antigravity-auth`](https://github.com/NoeFabris/opencode-antigravity-auth#readme). Add it before `@slkiser/opencode-quota` in `opencode.json`.
639
-
640
- </details>
641
-
642
- <a id="gemini-cli"></a>
643
- <details>
644
- <summary><strong>Gemini CLI</strong></summary>
645
-
646
- Use companion plugin [`opencode-gemini-auth`](https://github.com/jenslys/opencode-gemini-auth#readme). Add it before `@slkiser/opencode-quota` in `opencode.json`, then authenticate Google once:
647
-
648
- ```bash
649
- opencode auth login --provider google
650
- ```
651
-
652
- If you use manual provider selection, include `google-gemini-cli` in `enabledProviders`.
653
-
654
- </details>
655
-
656
- <a id="deepseek"></a>
657
- <details>
658
- <summary><strong>DeepSeek</strong></summary>
659
-
660
- DeepSeek shows the current on-demand account balance from `GET https://api.deepseek.com/user/balance`.
661
-
662
- Use one of these trusted API-key sources:
663
-
664
- ```bash
665
- export DEEPSEEK_API_KEY="your-api-key"
666
- ```
667
-
668
- Or put the key in trusted user/global OpenCode config, not repo-local config:
669
-
670
- ```jsonc
671
- {
672
- "provider": {
673
- "deepseek": {
674
- "options": { "apiKey": "{env:DEEPSEEK_API_KEY}" },
675
- },
676
- },
677
- }
678
- ```
679
-
680
- If you use manual provider selection, include `deepseek` in `enabledProviders`.
681
-
682
- </details>
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
-
703
- <a id="opencode-go"></a>
704
- <details>
705
- <summary><strong>OpenCode Go</strong></summary>
706
-
707
- OpenCode Go quota scrapes the dashboard and needs a workspace ID plus an `auth` cookie:
708
-
709
- ```bash
710
- export OPENCODE_GO_WORKSPACE_ID="your-workspace-id"
711
- export OPENCODE_GO_AUTH_COOKIE="your-auth-cookie"
712
- ```
713
-
714
- Use `opencodeGoWindows` to choose **5h**, **Weekly**, and/or **Monthly** windows. Environment variables take precedence over the optional `opencode-go.json` file.
715
-
716
- </details>
130
+ Setup details live in the [Provider setup guide](docs/readme/providers.md).
717
131
 
718
132
  ## Troubleshooting
719
133
 
720
- Start here when quota or token data looks wrong.
134
+ Start here when quota or token data looks wrong:
721
135
 
722
- 1. When the TUI plugin is installed, run `/quota_status`; otherwise start with `opencode-quota show` for a terminal quota summary.
136
+ 1. Run `/quota_status`, or start with `opencode-quota show` for a terminal quota summary.
723
137
  2. Confirm the expected provider appears in the detected provider list.
724
138
  3. Confirm companion auth plugins are before `@slkiser/opencode-quota` in `opencode.json`.
725
139
  4. If token reports are empty, start OpenCode once so it creates `opencode.db`, then run a session with model usage.
726
- 5. Use the provider-specific table below for the failing provider.
727
-
728
- ### Common symptoms
729
-
730
- | Symptom | Try this |
731
- | --- | --- |
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. |
734
- | Sidebar panel does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, and check `tuiSidebarPanel.enabled`. |
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. |
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. |
737
- | Popup toasts do not appear | Check `enableToast`, `showOnIdle`, `showOnQuestion`, and `showOnCompact`. |
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`. |
739
- | Token reports are empty | Start OpenCode once so `opencode.db` exists, then run a session with model usage. |
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. |
742
-
743
- ### Provider troubleshooting
744
-
745
- <details>
746
- <summary><strong>Anthropic (Claude)</strong></summary>
747
-
748
- When the TUI plugin is installed, run `/quota_status` and check the Anthropic section.
749
-
750
- | Symptom | Fix |
751
- | --- | --- |
752
- | `claude` not found | Install Claude Code and make sure `claude` is on your `PATH`. |
753
- | Claude is installed at a custom path | Set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`. |
754
- | Not authenticated | Run `claude auth login`, then confirm `claude auth status` works. |
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. |
756
- | Provider not detected | Confirm OpenCode is configured to use the `anthropic` provider. |
757
-
758
- </details>
759
-
760
- <details>
761
- <summary><strong>GitHub Copilot</strong></summary>
762
-
763
- When the TUI plugin is installed, run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_scope`, and `quota_api`.
764
-
765
- | Symptom | Fix |
766
- | --- | --- |
767
- | Personal quota missing | Confirm OpenCode Copilot auth works. The plugin can read OpenCode's Copilot OAuth token. |
768
- | Business or Enterprise quota missing | Add `copilot-quota-token.json` in the OpenCode runtime config directory shown by `opencode debug paths`. |
769
- | PAT config exists but quota fails | Fix `copilot-quota-token.json`; when present, it takes precedence over OAuth and does not silently fall back. |
770
- | Enterprise usage missing | Use a classic PAT with the required billing access. Fine-grained PATs and GitHub App tokens are not supported for Enterprise premium usage. |
771
-
772
- </details>
773
-
774
- <details>
775
- <summary><strong>OpenAI</strong></summary>
776
-
777
- When the TUI plugin is installed, run `/quota_status` and check the OpenAI auth source and token status.
778
-
779
- | Symptom | Fix |
780
- | --- | --- |
781
- | OpenAI quota missing | Confirm OpenCode native OpenAI OAuth is present in `auth.json`. |
782
- | Token expired | Re-run OpenCode's OpenAI auth flow. |
783
- | Provider not detected | Confirm your OpenCode config uses the `openai` provider or a compatible OpenAI auth entry. |
784
-
785
- </details>
786
-
787
- <details>
788
- <summary><strong>Cursor</strong></summary>
789
-
790
- When the TUI plugin is installed, run `/quota_status` and check the Cursor section.
791
-
792
- | Symptom | Fix |
793
- | --- | --- |
794
- | Cursor not detected | Put `@playwo/opencode-cursor-oauth` before `@slkiser/opencode-quota` in `opencode.json`. |
795
- | Cursor auth missing | Run `opencode auth login --provider cursor`. |
796
- | Quota appears but no remaining percentage | Set `cursorPlan` or `cursorIncludedApiUsd` in `opencode-quota/quota-toast.json`. |
797
- | Billing cycle looks wrong | Set `cursorBillingCycleStartDay` in `opencode-quota/quota-toast.json` to your local billing anchor day. |
798
- | Unknown Cursor pricing | Run `/pricing_refresh` when the TUI plugin is installed; if still unknown, check `/quota_status` for unknown model ids. |
799
-
800
- </details>
801
-
802
- <details>
803
- <summary><strong>Qwen Code</strong></summary>
804
-
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.
140
+ 5. Check [Troubleshooting](docs/readme/troubleshooting.md) for common symptoms and provider-specific fixes.
806
141
 
807
- | Symptom | Fix |
808
- | --- | --- |
809
- | Qwen not detected | Put `opencode-qwencode-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
810
- | Auth missing | Complete the Qwen companion plugin auth flow. |
811
- | Counters do not move | Confirm the current model is `qwen-code/*`; Qwen quota is local request estimation for matching model usage. |
812
- | Usage looks stale | When the TUI plugin is installed, check the local state file path shown by `/quota_status`. |
813
-
814
- </details>
815
-
816
- <details>
817
- <summary><strong>Alibaba Coding Plan</strong></summary>
818
-
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.
820
-
821
- | Symptom | Fix |
822
- | --- | --- |
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. |
824
- | Wrong tier | Set `alibabaCodingPlanTier` to `lite` or `pro` in `opencode-quota/quota-toast.json`. |
825
- | Counters do not move | Confirm the current model is `alibaba/*` or `alibaba-cn/*`. |
826
- | Quota seems stale | When the TUI plugin is installed, check the state-file path shown in `/quota_status`. |
827
-
828
- </details>
829
-
830
- <details>
831
- <summary><strong>MiniMax, Kimi, Chutes AI, Synthetic, Z.ai, Zhipu, NanoGPT, and DeepSeek</strong></summary>
832
-
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.
834
-
835
- | Provider | Useful checks |
836
- | --- | --- |
837
- | MiniMax Coding Plan | Use `MINIMAX_CODING_PLAN_API_KEY` or `MINIMAX_API_KEY` for the international endpoint. Runtime/config ids like `minimax` and `minimax-coding-plan` use this provider. Repo-local provider secrets are ignored. |
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. |
839
- | Kimi Code | Use `KIMI_API_KEY` or `KIMI_CODE_API_KEY`; repo-local provider secrets are ignored. |
840
- | Chutes AI | Use `CHUTES_API_KEY`, trusted user/global config, or OpenCode auth. |
841
- | Synthetic | Use `SYNTHETIC_API_KEY`, trusted user/global config, or OpenCode auth. |
842
- | Z.ai Coding Plan | Use `ZAI_API_KEY` or `ZAI_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
843
- | Zhipu Coding Plan | Use `ZHIPU_API_KEY` or `ZHIPU_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
844
- | NanoGPT | Use `NANOGPT_API_KEY`, `NANO_GPT_API_KEY`, trusted user/global config, or OpenCode auth. |
845
- | DeepSeek | Use `DEEPSEEK_API_KEY`, trusted user/global config under `provider.deepseek.options.apiKey`, or OpenCode auth. This provider shows balance only because DeepSeek does not expose a quota reset window. |
846
-
847
- For security, repo-local `opencode.json` / `opencode.jsonc` is ignored for provider secrets in these integrations. Put secrets in environment variables or trusted user/global config. OpenCode auth fallbacks for API-key providers require `{ "type": "api", "key": "..." }` entries.
848
-
849
- </details>
850
-
851
- <details>
852
- <summary><strong>Google Antigravity</strong></summary>
853
-
854
- When the TUI plugin is installed, run `/quota_status` and check the `google_antigravity` section.
855
-
856
- | Symptom | Fix |
857
- | --- | --- |
858
- | Companion missing | Put `opencode-antigravity-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
859
- | Accounts not found | When the TUI plugin is installed, check the selected `antigravity-accounts.json` path shown by `/quota_status`. |
860
- | Refresh tokens invalid | Re-authenticate with the companion plugin. |
861
- | Provider returns no rows | When the TUI plugin is installed, check `live_probe`, `live_entry_*`, and `live_error_*` in `/quota_status`. |
862
-
863
- </details>
864
-
865
- <details>
866
- <summary><strong>Gemini CLI</strong></summary>
867
-
868
- When the TUI plugin is installed, run `/quota_status` and check the Gemini CLI live probe rows.
869
-
870
- | Symptom | Fix |
871
- | --- | --- |
872
- | Companion missing | Put `opencode-gemini-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
873
- | Provider not enabled in manual mode | Include `google-gemini-cli` in `enabledProviders` in `opencode-quota/quota-toast.json`. |
874
- | Auth missing | Run `opencode auth login --provider google`. |
875
- | Project missing | Set `provider.google.options.projectId`, `OPENCODE_GEMINI_PROJECT_ID`, `GOOGLE_CLOUD_PROJECT`, or `GOOGLE_CLOUD_PROJECT_ID`. |
876
-
877
- </details>
878
-
879
- <details>
880
- <summary><strong>OpenCode Go</strong></summary>
881
-
882
- When the TUI plugin is installed, run `/quota_status` and check the `opencode_go` section.
883
-
884
- | Symptom | Fix |
885
- | --- | --- |
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. |
887
- | Incomplete config | `workspaceId` and `authCookie` must come from the same source. |
888
- | Scrape returns no data | Refresh the browser `auth` cookie from `opencode.ai`. |
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. |
890
- | Dashboard format changed | This integration scrapes the dashboard, so it can break if the dashboard markup changes. |
891
-
892
- </details>
893
-
894
- <details>
895
- <summary><strong>Token reports</strong></summary>
896
-
897
- When the TUI plugin is installed, run `/quota_status` and check pricing snapshot health plus OpenCode database paths.
898
-
899
- | Symptom | Fix |
900
- | --- | --- |
901
- | `/tokens_*` is empty | Start OpenCode once so it creates `opencode.db`, then run a session with model usage. |
902
- | Pricing looks stale | Run `/pricing_refresh` when the TUI plugin is installed. |
903
- | Runtime pricing does not change output | Check `pricingSnapshot.source` in `opencode-quota/quota-toast.json`; `bundled` keeps packaged pricing active. |
904
- | Cursor model has unknown pricing | Run `/pricing_refresh` when the TUI plugin is installed; Cursor `auto` and `composer*` use bundled deterministic pricing. |
142
+ ## Reference
905
143
 
906
- </details>
144
+ - [Manual install](docs/readme/manual-install.md)
145
+ - [Configuration](docs/readme/configuration.md)
146
+ - [Providers](docs/readme/providers.md)
147
+ - [Troubleshooting](docs/readme/troubleshooting.md)
148
+ - [External integration](docs/readme/external-integration.md)
907
149
 
908
150
  ## Contributors
909
151