@slkiser/opencode-quota 3.6.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -146
- package/dist/lib/crof-config.d.ts +21 -0
- package/dist/lib/crof-config.d.ts.map +1 -0
- package/dist/lib/crof-config.js +35 -0
- package/dist/lib/crof-config.js.map +1 -0
- package/dist/lib/crof.d.ts +13 -0
- package/dist/lib/crof.d.ts.map +1 -0
- package/dist/lib/crof.js +70 -0
- package/dist/lib/crof.js.map +1 -0
- package/dist/lib/provider-metadata.d.ts +3 -3
- package/dist/lib/provider-metadata.d.ts.map +1 -1
- package/dist/lib/provider-metadata.js +10 -0
- package/dist/lib/provider-metadata.js.map +1 -1
- package/dist/lib/quota-status.d.ts.map +1 -1
- package/dist/lib/quota-status.js +17 -0
- package/dist/lib/quota-status.js.map +1 -1
- package/dist/lib/types.d.ts +7 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/providers/crof.d.ts +6 -0
- package/dist/providers/crof.d.ts.map +1 -0
- package/dist/providers/crof.js +57 -0
- package/dist/providers/crof.js.map +1 -0
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +2 -0
- package/dist/providers/registry.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,61 +74,61 @@ If you also want the sidebar, add the same package to the `tui.json` or `tui.jso
|
|
|
74
74
|
Quota settings go in `opencode-quota/quota-toast.json` next to the OpenCode config file you chose during install. Existing `experimental.quotaToast` settings still work when no sidecar file exists. Quota settings do not live in `tui.json`.
|
|
75
75
|
|
|
76
76
|
<details>
|
|
77
|
-
<summary><
|
|
77
|
+
<summary><strong>Full configuration reference</strong></summary>
|
|
78
78
|
|
|
79
79
|
#### Core/shared settings
|
|
80
80
|
|
|
81
|
-
| Option
|
|
82
|
-
|
|
|
83
|
-
| `enabled`
|
|
84
|
-
| `enabledProviders`
|
|
85
|
-
| `minIntervalMs`
|
|
86
|
-
| `requestTimeoutMs`
|
|
87
|
-
| `formatStyle`
|
|
88
|
-
| `percentDisplayMode`
|
|
89
|
-
| `onlyCurrentModel`
|
|
90
|
-
| `showSessionTokens`
|
|
91
|
-
| `pricingSnapshot.source`
|
|
92
|
-
| `pricingSnapshot.autoRefresh` | `7`
|
|
81
|
+
| Option | Default | Meaning |
|
|
82
|
+
| ----------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `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. |
|
|
84
|
+
| `enabledProviders` | `"auto"` | Auto-detect providers, or set an explicit provider list. Unknown provider ids are reported under `config_errors` in `/quota_status`; an explicit list with no valid providers resolves to none instead of falling back to auto-detect. |
|
|
85
|
+
| `minIntervalMs` | `300000` | Minimum fetch interval between provider updates. |
|
|
86
|
+
| `requestTimeoutMs` | `5000` | Remote provider request timeout in milliseconds. Providers with custom defaults, such as Gemini CLI and OpenCode Go, keep their provider default unless this is explicitly configured. |
|
|
87
|
+
| `formatStyle` | `singleWindow` | Shared quota-row style for popup toasts and the TUI sidebar: `singleWindow` or `allWindows`. Legacy `classic`/`grouped` aliases still work, and legacy `toastStyle` is still accepted on read for backward compatibility. |
|
|
88
|
+
| `percentDisplayMode` | `remaining` | Shared percent meaning for popup toasts and the TUI sidebar: `remaining` renders labels like `81% left`; `used` renders labels like `19% used` or `125% used` when over quota. |
|
|
89
|
+
| `onlyCurrentModel` | `false` | Filter quota rows to the current model/provider when that session selection can be resolved. |
|
|
90
|
+
| `showSessionTokens` | `true` | Show the `Session input/output tokens` section in quota displays when session token data is available. |
|
|
91
|
+
| `pricingSnapshot.source` | `"auto"` | Token pricing snapshot selection for `/tokens_*`: `auto`, `bundled`, or `runtime`. |
|
|
92
|
+
| `pricingSnapshot.autoRefresh` | `7` | Refresh stale local pricing data after this many days. |
|
|
93
93
|
|
|
94
94
|
`percentDisplayMode` affects popup toasts and the TUI sidebar only. `/quota` keeps its existing remaining-oriented percentage output.
|
|
95
95
|
|
|
96
96
|
#### Toast settings
|
|
97
97
|
|
|
98
|
-
| Option
|
|
99
|
-
|
|
|
100
|
-
| `enableToast`
|
|
101
|
-
| `toastDurationMs` | `9000`
|
|
102
|
-
| `showOnIdle`
|
|
103
|
-
| `showOnQuestion`
|
|
104
|
-
| `showOnCompact`
|
|
105
|
-
| `showOnBothFail`
|
|
106
|
-
| `layout.maxWidth` | `50`
|
|
107
|
-
| `layout.narrowAt` | `42`
|
|
108
|
-
| `layout.tinyAt`
|
|
109
|
-
| `debug`
|
|
98
|
+
| Option | Default | Meaning |
|
|
99
|
+
| ----------------- | ------- | ------------------------------------------------------------------------------- |
|
|
100
|
+
| `enableToast` | `true` | Show popup toasts. Disabling this does not disable `/quota` or the TUI sidebar. |
|
|
101
|
+
| `toastDurationMs` | `9000` | Toast duration in milliseconds. |
|
|
102
|
+
| `showOnIdle` | `true` | Show a toast on the idle trigger. |
|
|
103
|
+
| `showOnQuestion` | `true` | Show a toast after a question/assistant response. |
|
|
104
|
+
| `showOnCompact` | `true` | Show a toast after session compaction. |
|
|
105
|
+
| `showOnBothFail` | `true` | Show a fallback toast when providers attempted quota reads and all failed. |
|
|
106
|
+
| `layout.maxWidth` | `50` | Toast formatting width target. Ignored by the TUI sidebar. |
|
|
107
|
+
| `layout.narrowAt` | `42` | Toast compact-layout breakpoint. Ignored by the TUI sidebar. |
|
|
108
|
+
| `layout.tinyAt` | `32` | Toast tiny-layout breakpoint. Ignored by the TUI sidebar. |
|
|
109
|
+
| `debug` | `false` | Append toast debug context when troubleshooting. |
|
|
110
110
|
|
|
111
111
|
#### TUI sidebar setup
|
|
112
112
|
|
|
113
113
|
If you want the `Quota` sidebar panel, you need the plugin in both OpenCode config surfaces:
|
|
114
114
|
|
|
115
|
-
| File
|
|
116
|
-
|
|
|
117
|
-
| `tui.json` / `tui.jsonc`
|
|
118
|
-
| `opencode.json` / `opencode.jsonc` | Server plugin entry
|
|
119
|
-
| `opencode-quota/quota-toast.json`
|
|
115
|
+
| File | What goes there | Needed for sidebar? |
|
|
116
|
+
| ---------------------------------- | ------------------------------------- | ------------------------------- |
|
|
117
|
+
| `tui.json` / `tui.jsonc` | `plugin: ["@slkiser/opencode-quota"]` | Yes |
|
|
118
|
+
| `opencode.json` / `opencode.jsonc` | Server plugin entry | Yes |
|
|
119
|
+
| `opencode-quota/quota-toast.json` | Quota settings | No, but controls quota behavior |
|
|
120
120
|
|
|
121
121
|
#### Provider-specific settings
|
|
122
122
|
|
|
123
|
-
| Option
|
|
124
|
-
|
|
|
125
|
-
| `anthropicBinaryPath`
|
|
126
|
-
| `googleModels`
|
|
127
|
-
| `opencodeGoWindows`
|
|
128
|
-
| `alibabaCodingPlanTier`
|
|
129
|
-
| `cursorPlan`
|
|
130
|
-
| `cursorIncludedApiUsd`
|
|
131
|
-
| `cursorBillingCycleStartDay` | unset
|
|
123
|
+
| Option | Default | Meaning |
|
|
124
|
+
| ---------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| `anthropicBinaryPath` | `"claude"` | Command/path used for local Claude CLI probing; override this for custom installs or shim locations. |
|
|
126
|
+
| `googleModels` | `["CLAUDE"]` | Google model keys to query: `CLAUDE`, `G3PRO`, `G3FLASH`, `G3IMAGE`. |
|
|
127
|
+
| `opencodeGoWindows` | `["rolling", "weekly", "monthly"]` | OpenCode Go usage windows to display. |
|
|
128
|
+
| `alibabaCodingPlanTier` | `"lite"` | Fallback Alibaba Coding Plan tier when auth does not include `tier`. |
|
|
129
|
+
| `cursorPlan` | `"none"` | Cursor included API budget preset: `none`, `pro`, `pro-plus`, `ultra`. |
|
|
130
|
+
| `cursorIncludedApiUsd` | unset | Override Cursor monthly included API budget in USD. |
|
|
131
|
+
| `cursorBillingCycleStartDay` | unset | Local billing-cycle anchor day `1..28`; when unset, Cursor usage resets on the local calendar month. |
|
|
132
132
|
|
|
133
133
|
</details>
|
|
134
134
|
|
|
@@ -158,23 +158,24 @@ If you want the `Quota` sidebar panel, you need the plugin in both OpenCode conf
|
|
|
158
158
|
|
|
159
159
|
### Providers
|
|
160
160
|
|
|
161
|
-
| Provider
|
|
162
|
-
|
|
|
163
|
-
| Anthropic (Claude)
|
|
164
|
-
| GitHub Copilot
|
|
165
|
-
| OpenAI
|
|
166
|
-
| Cursor
|
|
167
|
-
| Qwen Code
|
|
168
|
-
| Alibaba Coding Plan
|
|
169
|
-
| MiniMax Coding Plan
|
|
170
|
-
| Kimi Code
|
|
171
|
-
| Chutes AI
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
161
|
+
| Provider | Auto setup? | Setup / plugin order | Quota source |
|
|
162
|
+
| ------------------- | ---------------------------------------------------- | -------------------------------------------------------------- | ------------------------ |
|
|
163
|
+
| Anthropic (Claude) | [Needs quick setup](#anthropic-claude-quick-setup) | Install and authenticate Claude CLI | Local CLI or OAuth usage |
|
|
164
|
+
| GitHub Copilot | Usually automatic | Existing OpenCode auth, or optional PAT config | Remote API |
|
|
165
|
+
| OpenAI | Automatic | Existing OpenCode OAuth | Remote API |
|
|
166
|
+
| Cursor | [Needs quick setup](#cursor-quick-setup) | `["@playwo/opencode-cursor-oauth", "@slkiser/opencode-quota"]` | Local estimation |
|
|
167
|
+
| Qwen Code | [Needs quick setup](#qwen-code-quick-setup) | `["opencode-qwencode-auth", "@slkiser/opencode-quota"]` | Local estimation |
|
|
168
|
+
| Alibaba Coding Plan | Automatic | Existing OpenCode auth, global config, or env | Local estimation |
|
|
169
|
+
| MiniMax Coding Plan | Automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
170
|
+
| Kimi Code | Automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
171
|
+
| Chutes AI | Usually automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
172
|
+
| Crof.ai | Manual env/config | `CROF_API_KEY` or trusted user/global config | Remote API |
|
|
173
|
+
| Synthetic | Automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
174
|
+
| Google Antigravity | [Needs quick setup](#google-antigravity-quick-setup) | `["opencode-antigravity-auth", "@slkiser/opencode-quota"]` | Remote API |
|
|
175
|
+
| Gemini CLI | [Needs quick setup](#gemini-cli-quick-setup) | `["opencode-gemini-auth", "@slkiser/opencode-quota"]` | Remote API |
|
|
176
|
+
| Z.ai Coding Plan | Automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
177
|
+
| NanoGPT | Usually automatic | Existing OpenCode auth, global config, or env | Remote API |
|
|
178
|
+
| OpenCode Go | [Needs quick setup](#opencode-go-quick-setup) | Set workspace ID and `auth` cookie | Dashboard scraping |
|
|
178
179
|
|
|
179
180
|
Providers are auto-detected by default. To choose providers explicitly, set `enabledProviders` in `opencode-quota/quota-toast.json`:
|
|
180
181
|
|
|
@@ -189,7 +190,7 @@ Providers are auto-detected by default. To choose providers explicitly, set `ena
|
|
|
189
190
|
Customize these settings in `opencode-quota/quota-toast.json`.
|
|
190
191
|
|
|
191
192
|
<details>
|
|
192
|
-
<summary><
|
|
193
|
+
<summary><strong>Show every quota window</strong></summary>
|
|
193
194
|
|
|
194
195
|
Instead of the default most-constrained window:
|
|
195
196
|
|
|
@@ -202,7 +203,7 @@ Instead of the default most-constrained window:
|
|
|
202
203
|
</details>
|
|
203
204
|
|
|
204
205
|
<details>
|
|
205
|
-
<summary><
|
|
206
|
+
<summary><strong>Choose OpenCode Go windows</strong></summary>
|
|
206
207
|
|
|
207
208
|
Choose which OpenCode Go windows to display:
|
|
208
209
|
|
|
@@ -215,7 +216,7 @@ Choose which OpenCode Go windows to display:
|
|
|
215
216
|
</details>
|
|
216
217
|
|
|
217
218
|
<details>
|
|
218
|
-
<summary><
|
|
219
|
+
<summary><strong>Show used percentages</strong></summary>
|
|
219
220
|
|
|
220
221
|
Show percentages as used instead of remaining in toasts and the sidebar:
|
|
221
222
|
|
|
@@ -228,7 +229,7 @@ Show percentages as used instead of remaining in toasts and the sidebar:
|
|
|
228
229
|
</details>
|
|
229
230
|
|
|
230
231
|
<details>
|
|
231
|
-
<summary><
|
|
232
|
+
<summary><strong>Turn off popup toasts</strong></summary>
|
|
232
233
|
|
|
233
234
|
Keep `/quota` and the sidebar enabled:
|
|
234
235
|
|
|
@@ -241,7 +242,7 @@ Keep `/quota` and the sidebar enabled:
|
|
|
241
242
|
</details>
|
|
242
243
|
|
|
243
244
|
<details>
|
|
244
|
-
<summary><
|
|
245
|
+
<summary><strong>Increase request timeout</strong></summary>
|
|
245
246
|
|
|
246
247
|
Increase the remote provider request timeout from the default 5000ms. Providers with custom defaults, such as Gemini CLI and OpenCode Go, keep their provider default unless you set this.
|
|
247
248
|
|
|
@@ -254,7 +255,7 @@ Increase the remote provider request timeout from the default 5000ms. Providers
|
|
|
254
255
|
</details>
|
|
255
256
|
|
|
256
257
|
<details>
|
|
257
|
-
<summary><
|
|
258
|
+
<summary><strong>Advanced: legacy config sync</strong></summary>
|
|
258
259
|
|
|
259
260
|
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:
|
|
260
261
|
|
|
@@ -314,9 +315,9 @@ Add both plugins to `opencode.json`, with the Cursor auth plugin first:
|
|
|
314
315
|
"plugin": ["@playwo/opencode-cursor-oauth", "@slkiser/opencode-quota"],
|
|
315
316
|
"provider": {
|
|
316
317
|
"cursor": {
|
|
317
|
-
"name": "Cursor"
|
|
318
|
-
}
|
|
319
|
-
}
|
|
318
|
+
"name": "Cursor",
|
|
319
|
+
},
|
|
320
|
+
},
|
|
320
321
|
}
|
|
321
322
|
```
|
|
322
323
|
|
|
@@ -337,7 +338,7 @@ Add both plugins to `opencode.json`, with the Qwen auth plugin first:
|
|
|
337
338
|
```jsonc
|
|
338
339
|
{
|
|
339
340
|
"$schema": "https://opencode.ai/config.json",
|
|
340
|
-
"plugin": ["opencode-qwencode-auth", "@slkiser/opencode-quota"]
|
|
341
|
+
"plugin": ["opencode-qwencode-auth", "@slkiser/opencode-quota"],
|
|
341
342
|
}
|
|
342
343
|
```
|
|
343
344
|
|
|
@@ -352,7 +353,7 @@ Add both plugins to `opencode.json`, with the Antigravity auth plugin first:
|
|
|
352
353
|
```jsonc
|
|
353
354
|
{
|
|
354
355
|
"$schema": "https://opencode.ai/config.json",
|
|
355
|
-
"plugin": ["opencode-antigravity-auth", "@slkiser/opencode-quota"]
|
|
356
|
+
"plugin": ["opencode-antigravity-auth", "@slkiser/opencode-quota"],
|
|
356
357
|
}
|
|
357
358
|
```
|
|
358
359
|
|
|
@@ -367,7 +368,7 @@ Add both plugins to `opencode.json`, with the Gemini auth plugin first:
|
|
|
367
368
|
```jsonc
|
|
368
369
|
{
|
|
369
370
|
"$schema": "https://opencode.ai/config.json",
|
|
370
|
-
"plugin": ["opencode-gemini-auth", "@slkiser/opencode-quota"]
|
|
371
|
+
"plugin": ["opencode-gemini-auth", "@slkiser/opencode-quota"],
|
|
371
372
|
}
|
|
372
373
|
```
|
|
373
374
|
|
|
@@ -409,162 +410,163 @@ If quota or token data looks wrong:
|
|
|
409
410
|
For companion providers, confirm the auth plugin appears before `@slkiser/opencode-quota` in `opencode.json`.
|
|
410
411
|
|
|
411
412
|
<details>
|
|
412
|
-
<summary><
|
|
413
|
+
<summary><strong>Anthropic (Claude)</strong></summary>
|
|
413
414
|
|
|
414
415
|
Run `/quota_status` and check the Anthropic section.
|
|
415
416
|
|
|
416
|
-
| Symptom
|
|
417
|
-
|
|
|
418
|
-
| `claude` not found
|
|
419
|
-
| Claude is installed at a custom path | Set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`.
|
|
420
|
-
| Not authenticated
|
|
421
|
-
| Auth works but no quota rows appear
|
|
422
|
-
| Provider not detected
|
|
417
|
+
| Symptom | Fix |
|
|
418
|
+
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
419
|
+
| `claude` not found | Install Claude Code and make sure `claude` is on your `PATH`. |
|
|
420
|
+
| Claude is installed at a custom path | Set `anthropicBinaryPath` in `opencode-quota/quota-toast.json`. |
|
|
421
|
+
| Not authenticated | Run `claude auth login`, then confirm `claude auth status` works. |
|
|
422
|
+
| Auth works but no quota rows appear | Check `quota_source` and `message` in `/quota_status`; re-authenticate Claude if the OAuth credential fallback is missing or stale. |
|
|
423
|
+
| Provider not detected | Confirm OpenCode is configured to use the `anthropic` provider. |
|
|
423
424
|
|
|
424
425
|
</details>
|
|
425
426
|
|
|
426
427
|
<details>
|
|
427
|
-
<summary><
|
|
428
|
+
<summary><strong>GitHub Copilot</strong></summary>
|
|
428
429
|
|
|
429
430
|
Run `/quota_status` and check `copilot_quota_auth`, `billing_mode`, `billing_scope`, and `quota_api`.
|
|
430
431
|
|
|
431
|
-
| Symptom
|
|
432
|
-
|
|
|
433
|
-
| Personal quota missing
|
|
434
|
-
| Business or Enterprise quota missing | Add `copilot-quota-token.json` in the OpenCode runtime config directory shown by `opencode debug paths`.
|
|
435
|
-
| PAT config exists but quota fails
|
|
436
|
-
| Enterprise usage missing
|
|
432
|
+
| Symptom | Fix |
|
|
433
|
+
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
434
|
+
| Personal quota missing | Confirm OpenCode Copilot auth works. The plugin can read OpenCode's Copilot OAuth token. |
|
|
435
|
+
| Business or Enterprise quota missing | Add `copilot-quota-token.json` in the OpenCode runtime config directory shown by `opencode debug paths`. |
|
|
436
|
+
| PAT config exists but quota fails | Fix `copilot-quota-token.json`; when present, it takes precedence over OAuth and does not silently fall back. |
|
|
437
|
+
| 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. |
|
|
437
438
|
|
|
438
439
|
</details>
|
|
439
440
|
|
|
440
441
|
<details>
|
|
441
|
-
<summary><
|
|
442
|
+
<summary><strong>OpenAI</strong></summary>
|
|
442
443
|
|
|
443
444
|
Run `/quota_status` and check the OpenAI auth source and token status.
|
|
444
445
|
|
|
445
|
-
| Symptom
|
|
446
|
-
|
|
|
447
|
-
| OpenAI quota missing
|
|
448
|
-
| Token expired
|
|
446
|
+
| Symptom | Fix |
|
|
447
|
+
| --------------------- | ------------------------------------------------------------------------------------------ |
|
|
448
|
+
| OpenAI quota missing | Confirm OpenCode native OpenAI OAuth is present in `auth.json`. |
|
|
449
|
+
| Token expired | Re-run OpenCode's OpenAI auth flow. |
|
|
449
450
|
| Provider not detected | Confirm your OpenCode config uses the `openai` provider or a compatible OpenAI auth entry. |
|
|
450
451
|
|
|
451
452
|
</details>
|
|
452
453
|
|
|
453
454
|
<details>
|
|
454
|
-
<summary><
|
|
455
|
+
<summary><strong>Cursor</strong></summary>
|
|
455
456
|
|
|
456
457
|
Run `/quota_status` and check the Cursor section.
|
|
457
458
|
|
|
458
|
-
| Symptom
|
|
459
|
-
|
|
|
460
|
-
| Cursor not detected
|
|
461
|
-
| Cursor auth missing
|
|
462
|
-
| Quota appears but no remaining percentage | Set `cursorPlan` or `cursorIncludedApiUsd` in `opencode-quota/quota-toast.json`.
|
|
463
|
-
| Billing cycle looks wrong
|
|
464
|
-
| Unknown Cursor pricing
|
|
459
|
+
| Symptom | Fix |
|
|
460
|
+
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
461
|
+
| Cursor not detected | Put `@playwo/opencode-cursor-oauth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
462
|
+
| Cursor auth missing | Run `opencode auth login --provider cursor`. |
|
|
463
|
+
| Quota appears but no remaining percentage | Set `cursorPlan` or `cursorIncludedApiUsd` in `opencode-quota/quota-toast.json`. |
|
|
464
|
+
| Billing cycle looks wrong | Set `cursorBillingCycleStartDay` in `opencode-quota/quota-toast.json` to your local billing anchor day. |
|
|
465
|
+
| Unknown Cursor pricing | Run `/pricing_refresh`; if still unknown, check `/quota_status` for unknown model ids. |
|
|
465
466
|
|
|
466
467
|
</details>
|
|
467
468
|
|
|
468
469
|
<details>
|
|
469
|
-
<summary><
|
|
470
|
+
<summary><strong>Qwen Code</strong></summary>
|
|
470
471
|
|
|
471
472
|
Run `/quota_status` and check `qwen_oauth_source`, `qwen_local_plan`, and the `qwen_code` live probe section.
|
|
472
473
|
|
|
473
|
-
| Symptom
|
|
474
|
-
|
|
|
475
|
-
| Qwen not detected
|
|
476
|
-
| Auth missing
|
|
474
|
+
| Symptom | Fix |
|
|
475
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
476
|
+
| Qwen not detected | Put `opencode-qwencode-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
477
|
+
| Auth missing | Complete the Qwen companion plugin auth flow. |
|
|
477
478
|
| Counters do not move | Confirm the current model is `qwen-code/*`; Qwen quota is local request estimation for matching model usage. |
|
|
478
|
-
| Usage looks stale
|
|
479
|
+
| Usage looks stale | Check the local state file path shown by `/quota_status`. |
|
|
479
480
|
|
|
480
481
|
</details>
|
|
481
482
|
|
|
482
483
|
<details>
|
|
483
|
-
<summary><
|
|
484
|
+
<summary><strong>Alibaba Coding Plan</strong></summary>
|
|
484
485
|
|
|
485
486
|
Run `/quota_status` and check the Alibaba auth, resolved tier, state-file path, and `alibaba_coding_plan` live probe section.
|
|
486
487
|
|
|
487
|
-
| Symptom
|
|
488
|
-
|
|
|
488
|
+
| Symptom | Fix |
|
|
489
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
489
490
|
| 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. |
|
|
490
|
-
| Wrong tier
|
|
491
|
-
| Counters do not move | Confirm the current model is `alibaba/*` or `alibaba-cn/*`.
|
|
492
|
-
| Quota seems stale
|
|
491
|
+
| Wrong tier | Set `alibabaCodingPlanTier` to `lite` or `pro` in `opencode-quota/quota-toast.json`. |
|
|
492
|
+
| Counters do not move | Confirm the current model is `alibaba/*` or `alibaba-cn/*`. |
|
|
493
|
+
| Quota seems stale | Check the state-file path shown in `/quota_status`. |
|
|
493
494
|
|
|
494
495
|
</details>
|
|
495
496
|
|
|
496
497
|
<details>
|
|
497
|
-
<summary><
|
|
498
|
+
<summary><strong>MiniMax, Kimi, Chutes AI, Crof.ai, Synthetic, Z.ai, and NanoGPT</strong></summary>
|
|
498
499
|
|
|
499
|
-
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth. Run `/quota_status` and check the provider-specific API-key diagnostics.
|
|
500
|
+
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth. Run `/quota_status` and check the provider-specific API-key diagnostics (Crof.ai is env/config only).
|
|
500
501
|
|
|
501
|
-
| Provider
|
|
502
|
-
|
|
|
503
|
-
| MiniMax Coding Plan | Use `MINIMAX_CODING_PLAN_API_KEY` or `MINIMAX_API_KEY`; repo-local provider secrets are ignored.
|
|
504
|
-
| Kimi Code
|
|
505
|
-
| Chutes AI
|
|
506
|
-
|
|
|
507
|
-
|
|
|
508
|
-
|
|
|
502
|
+
| Provider | Useful checks |
|
|
503
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
504
|
+
| MiniMax Coding Plan | Use `MINIMAX_CODING_PLAN_API_KEY` or `MINIMAX_API_KEY`; repo-local provider secrets are ignored. |
|
|
505
|
+
| Kimi Code | Use `KIMI_API_KEY` or `KIMI_CODE_API_KEY`; repo-local provider secrets are ignored. |
|
|
506
|
+
| Chutes AI | Use `CHUTES_API_KEY` or trusted user/global config. |
|
|
507
|
+
| Crof.ai | Use `CROF_API_KEY` or trusted user/global config. |
|
|
508
|
+
| Synthetic | Use `SYNTHETIC_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
509
|
+
| Z.ai Coding Plan | Use `ZAI_API_KEY` or `ZAI_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
510
|
+
| NanoGPT | Use `NANOGPT_API_KEY`, `NANO_GPT_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
509
511
|
|
|
510
512
|
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.
|
|
511
513
|
|
|
512
514
|
</details>
|
|
513
515
|
|
|
514
516
|
<details>
|
|
515
|
-
<summary><
|
|
517
|
+
<summary><strong>Google Antigravity</strong></summary>
|
|
516
518
|
|
|
517
519
|
Run `/quota_status` and check the `google_antigravity` section.
|
|
518
520
|
|
|
519
|
-
| Symptom
|
|
520
|
-
|
|
|
521
|
-
| Companion missing
|
|
522
|
-
| Accounts not found
|
|
523
|
-
| Refresh tokens invalid
|
|
524
|
-
| Provider returns no rows | Check `live_probe`, `live_entry_*`, and `live_error_*` in `/quota_status`.
|
|
521
|
+
| Symptom | Fix |
|
|
522
|
+
| ------------------------ | ------------------------------------------------------------------------------------ |
|
|
523
|
+
| Companion missing | Put `opencode-antigravity-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
524
|
+
| Accounts not found | Check the selected `antigravity-accounts.json` path shown by `/quota_status`. |
|
|
525
|
+
| Refresh tokens invalid | Re-authenticate with the companion plugin. |
|
|
526
|
+
| Provider returns no rows | Check `live_probe`, `live_entry_*`, and `live_error_*` in `/quota_status`. |
|
|
525
527
|
|
|
526
528
|
</details>
|
|
527
529
|
|
|
528
530
|
<details>
|
|
529
|
-
<summary><
|
|
531
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
530
532
|
|
|
531
533
|
Run `/quota_status` and check the Gemini CLI live probe rows.
|
|
532
534
|
|
|
533
|
-
| Symptom
|
|
534
|
-
|
|
|
535
|
-
| Companion missing
|
|
536
|
-
| Provider not enabled in manual mode | Include `google-gemini-cli` in `enabledProviders` in `opencode-quota/quota-toast.json`.
|
|
537
|
-
| Auth missing
|
|
538
|
-
| Project missing
|
|
535
|
+
| Symptom | Fix |
|
|
536
|
+
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
537
|
+
| Companion missing | Put `opencode-gemini-auth` before `@slkiser/opencode-quota` in `opencode.json`. |
|
|
538
|
+
| Provider not enabled in manual mode | Include `google-gemini-cli` in `enabledProviders` in `opencode-quota/quota-toast.json`. |
|
|
539
|
+
| Auth missing | Run `opencode auth login --provider google`. |
|
|
540
|
+
| Project missing | Set `provider.google.options.projectId`, `OPENCODE_GEMINI_PROJECT_ID`, `GOOGLE_CLOUD_PROJECT`, or `GOOGLE_CLOUD_PROJECT_ID`. |
|
|
539
541
|
|
|
540
542
|
</details>
|
|
541
543
|
|
|
542
544
|
<details>
|
|
543
|
-
<summary><
|
|
545
|
+
<summary><strong>OpenCode Go</strong></summary>
|
|
544
546
|
|
|
545
547
|
Run `/quota_status` and check the `opencode_go` section.
|
|
546
548
|
|
|
547
|
-
| Symptom
|
|
548
|
-
|
|
|
549
|
-
| Config not detected
|
|
550
|
-
| Incomplete config
|
|
551
|
-
| Scrape returns no data
|
|
552
|
-
| Selected window missing
|
|
553
|
-
| Dashboard format changed | This integration scrapes the dashboard, so it can break if the dashboard markup changes.
|
|
549
|
+
| Symptom | Fix |
|
|
550
|
+
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
551
|
+
| Config not detected | Set both `OPENCODE_GO_WORKSPACE_ID` and `OPENCODE_GO_AUTH_COOKIE`, then rerun `/quota_status`. |
|
|
552
|
+
| Incomplete config | `workspaceId` and `authCookie` must come from the same source. |
|
|
553
|
+
| Scrape returns no data | Refresh the browser `auth` cookie from `opencode.ai`. |
|
|
554
|
+
| Selected window missing | 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. |
|
|
555
|
+
| Dashboard format changed | This integration scrapes the dashboard, so it can break if the dashboard markup changes. |
|
|
554
556
|
|
|
555
557
|
</details>
|
|
556
558
|
|
|
557
559
|
<details>
|
|
558
|
-
<summary><
|
|
560
|
+
<summary><strong>Token Reports</strong></summary>
|
|
559
561
|
|
|
560
562
|
Run `/quota_status` and check pricing snapshot health plus OpenCode database paths.
|
|
561
563
|
|
|
562
|
-
| Symptom
|
|
563
|
-
|
|
|
564
|
-
| `/tokens_*` is empty
|
|
565
|
-
| Pricing looks stale
|
|
564
|
+
| Symptom | Fix |
|
|
565
|
+
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
566
|
+
| `/tokens_*` is empty | Start OpenCode once so it creates `opencode.db`, then run a session with model usage. |
|
|
567
|
+
| Pricing looks stale | Run `/pricing_refresh`. |
|
|
566
568
|
| Runtime pricing does not change output | Check `pricingSnapshot.source` in `opencode-quota/quota-toast.json`; `bundled` keeps packaged pricing active. |
|
|
567
|
-
| Cursor model has unknown pricing
|
|
569
|
+
| Cursor model has unknown pricing | Run `/pricing_refresh`; Cursor `auto` and `composer*` use bundled deterministic pricing. |
|
|
568
570
|
|
|
569
571
|
</details>
|
|
570
572
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crof.ai API key configuration resolver.
|
|
3
|
+
*
|
|
4
|
+
* Resolution priority (first wins):
|
|
5
|
+
* 1. Environment variable: CROF_API_KEY
|
|
6
|
+
* 2. User/global opencode.json/opencode.jsonc: provider.crof.options.apiKey
|
|
7
|
+
*/
|
|
8
|
+
export interface CrofApiKeyResult {
|
|
9
|
+
key: string;
|
|
10
|
+
source: CrofKeySource;
|
|
11
|
+
}
|
|
12
|
+
export type CrofKeySource = "env:CROF_API_KEY" | "opencode.json" | "opencode.jsonc";
|
|
13
|
+
export { getGlobalOpencodeConfigCandidatePaths as getOpencodeConfigCandidatePaths } from "./api-key-resolver.js";
|
|
14
|
+
export declare function resolveCrofApiKey(): Promise<CrofApiKeyResult | null>;
|
|
15
|
+
export declare function hasCrofApiKey(): Promise<boolean>;
|
|
16
|
+
export declare function getCrofKeyDiagnostics(): Promise<{
|
|
17
|
+
configured: boolean;
|
|
18
|
+
source: CrofKeySource | null;
|
|
19
|
+
checkedPaths: string[];
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=crof-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crof-config.d.ts","sourceRoot":"","sources":["../../src/lib/crof-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;CACvB;AAKD,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEpF,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAEjH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAY1E;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAGtD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC,CAMD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crof.ai API key configuration resolver.
|
|
3
|
+
*
|
|
4
|
+
* Resolution priority (first wins):
|
|
5
|
+
* 1. Environment variable: CROF_API_KEY
|
|
6
|
+
* 2. User/global opencode.json/opencode.jsonc: provider.crof.options.apiKey
|
|
7
|
+
*/
|
|
8
|
+
import { extractProviderOptionsApiKey, getApiKeyDiagnostics, getGlobalOpencodeConfigCandidatePaths, resolveApiKeyFromEnvAndConfig, } from "./api-key-resolver.js";
|
|
9
|
+
const ALLOWED_CROF_ENV_VARS = ["CROF_API_KEY"];
|
|
10
|
+
const CROF_PROVIDER_KEYS = ["crof"];
|
|
11
|
+
export { getGlobalOpencodeConfigCandidatePaths as getOpencodeConfigCandidatePaths } from "./api-key-resolver.js";
|
|
12
|
+
export async function resolveCrofApiKey() {
|
|
13
|
+
return resolveApiKeyFromEnvAndConfig({
|
|
14
|
+
envVars: [{ name: "CROF_API_KEY", source: "env:CROF_API_KEY" }],
|
|
15
|
+
extractFromConfig: (config) => extractProviderOptionsApiKey(config, {
|
|
16
|
+
providerKeys: CROF_PROVIDER_KEYS,
|
|
17
|
+
allowedEnvVars: ALLOWED_CROF_ENV_VARS,
|
|
18
|
+
}),
|
|
19
|
+
configJsonSource: "opencode.json",
|
|
20
|
+
configJsoncSource: "opencode.jsonc",
|
|
21
|
+
getConfigCandidates: getGlobalOpencodeConfigCandidatePaths,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export async function hasCrofApiKey() {
|
|
25
|
+
const result = await resolveCrofApiKey();
|
|
26
|
+
return result !== null;
|
|
27
|
+
}
|
|
28
|
+
export async function getCrofKeyDiagnostics() {
|
|
29
|
+
return getApiKeyDiagnostics({
|
|
30
|
+
envVarNames: ["CROF_API_KEY"],
|
|
31
|
+
resolve: resolveCrofApiKey,
|
|
32
|
+
getConfigCandidates: getGlobalOpencodeConfigCandidatePaths,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=crof-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crof-config.js","sourceRoot":"","sources":["../../src/lib/crof-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAO/B,MAAM,qBAAqB,GAAG,CAAC,cAAc,CAAU,CAAC;AACxD,MAAM,kBAAkB,GAAG,CAAC,MAAM,CAAU,CAAC;AAI7C,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAEjH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,6BAA6B,CAAgB;QAClD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;QAC/D,iBAAiB,EAAE,CAAC,MAAM,EAAE,EAAE,CAC5B,4BAA4B,CAAC,MAAM,EAAE;YACnC,YAAY,EAAE,kBAAkB;YAChC,cAAc,EAAE,qBAAqB;SACtC,CAAC;QACJ,gBAAgB,EAAE,eAAe;QACjC,iBAAiB,EAAE,gBAAgB;QACnC,mBAAmB,EAAE,qCAAqC;KAC3D,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACzC,OAAO,MAAM,KAAK,IAAI,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB;IAKzC,OAAO,oBAAoB,CAAgB;QACzC,WAAW,EAAE,CAAC,cAAc,CAAC;QAC7B,OAAO,EAAE,iBAAiB;QAC1B,mBAAmB,EAAE,qCAAqC;KAC3D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crof.ai quota fetcher.
|
|
3
|
+
*
|
|
4
|
+
* Resolves API key from multiple sources and queries:
|
|
5
|
+
* https://crof.ai/usage_api/
|
|
6
|
+
*/
|
|
7
|
+
import type { CrofResult } from "./types.js";
|
|
8
|
+
export { getCrofKeyDiagnostics, hasCrofApiKey as hasCrofApiKeyConfigured, type CrofKeySource } from "./crof-config.js";
|
|
9
|
+
export declare function formatCrofCreditsValue(credits: number): string;
|
|
10
|
+
export declare function queryCrofQuota(options?: {
|
|
11
|
+
requestTimeoutMs?: number;
|
|
12
|
+
}): Promise<CrofResult>;
|
|
13
|
+
//# sourceMappingURL=crof.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crof.d.ts","sourceRoot":"","sources":["../../src/lib/crof.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAoB7C,OAAO,EAAE,qBAAqB,EAAE,aAAa,IAAI,uBAAuB,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA6BvH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,wBAAsB,cAAc,CAAC,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAgCrG"}
|