dsh-comcode-quota
chygyo/dsh-comcode-quota
侧边栏里的 Command Code 额度监控:5 小时 / 每周 / 每月三个窗口的剩余额度、重置倒计时与消耗速度预测,75 个模型的价目表,按模型的用量明细,以及本计费周期的 TOKEN 与请求总量。它的 HTTP 路由没有 DSH 的访问检查,浏览器里打开的网页可以调用它们。
安装
dsh plugin --profile web add github:chygyo/dsh-comcode-quotaREADME
Command Code quota (DSH plugin)
Live Command Code (GOAT plan) quota monitoring in the DeepSeek Harness sidebar: how much is left in the 5-hour / weekly / monthly windows, how fast it burns, and whether it lasts until reset.
This is a DSH re-host of the desktop app cc-quota-monitor. The Electron tray window and floating widget are gone; the UI is now a sidebar panel with five tabs.
Install
Recommended: one-click tarball (no clone, no dependencies, no build)
Paste this URL into Plugins → Add plugin in DSH:
https://github.com/Chygyo/dsh-comcode-quota/releases/download/v1.0.0/dsh-comcode-quota.tgz
Or have an agent call plugin_manager with action: install_bundle and that same URL as target. The plugin is dependency-free plain JS and works as soon as it is enabled.
Developer route: clone the repo and pass the package directory as target, or drop the directory at ~/.dsh/bundles/dsh-comcode-quota and install from there.
After enabling, a Quota row appears in the sidebar below Skill explorer. Client-side edits to client.js need the plugin toggled off and on again to reload.
If install reports an unsatisfied
engines.dsh: this plugin needs DSH ≥ 0.2.2-rc.3. Older harness versions lack thesidebar.panellistpanel slot, so the entry would never show up.
Credentials
Resolved in this order, first hit wins:
- Manual key saved from the Settings tab (stored in
~/.dsh/dsh-comcode-quota/settings.json, mode 600) - DSH credential store — refs
COMMANDCODE_API_KEY,CMD_GOAT_API_KEY,COMMAND_CODE_API_KEY. If you already use Command Code models in DSH, the key is in there and this plugin needs zero setup. Read through thecredentialsservice (looked up lazily, so a profile without a credential provider still installs fine) - Environment
CMD_GOAT_API_KEY/COMMANDCODE_API_KEY/COMMAND_CODE_API_KEY ~/.commandcode/auth.jsonwritten by the Command Code CLI (change triggers an automatic refresh)
When none of the four works, the Overview tab does not show a bare error: it shows a three-step setup guide (where to get a key, where to put it, a "check again" button) plus the live state of all four sources. The same list is available at POST /api/dsh-comcode-quota/credentials/probe.
The Usage by model tab needs something else: it reads /internal/usage/by-model, which is authenticated by the browser session cookie, not by an API key. If that tab reports no session, sign in to commandcode.ai once in Edge/Chrome/Brave/Arc/Vivaldi on the same machine — the plugin decrypts the cookie from the local browser profile (Keychain-backed) and never sends it anywhere else. It explains exactly that instead of reusing the API-key guide.
Tabs
| Tab | Contents |
|---|---|
| Overview | Top bar (account, last fetch), three this-period cards (total tokens, total requests, CLOUD minutes this month), a large remaining-credit figure, and three window cards (remaining/total, used %, reset countdown, burn rate, projected exhaustion, rate ceiling to last until reset, daily budget) |
| Usage by model | Real spend per model: requests, tokens and credit share (share is based on credits consumed this month, not token count). Filterable and sortable. Reads the official /internal/usage/by-model endpoint, so it needs a signed-in commandcode.ai session in your browser |
| Pricing | Per-million prices for 75 models — input, output, cache read and cache write. Click any column header to sort (defaults to estimated cost ascending; rows without a value always sort last). "Requests left" follows the window you pick (5-hour / weekly / monthly) using the official per-window counts from the pricing page; when the page has no count for a model, a rough estimate is shown with a leading ≈ |
| Settings | Credential source, API base URL, server fetch interval, timeout, history retention (including clearing samples), thresholds |
| Diagnostics | Version, Node, credential source, data directory, sample count, last fetch latency, errors, raw log |
The period totals and the per-day bars live inside Overview instead of taking a tab of their own.
Where data lives
~/.dsh/dsh-comcode-quota/: settings.json, history.json, app.log. Deleting the directory resets everything.
Host routes
Eleven routes, all behind a loopback guard (off-machine, proxied, or cross-site requests get 403):
GET /api/dsh-comcode-quota/state
POST /api/dsh-comcode-quota/refresh
GET /api/dsh-comcode-quota/settings
POST /api/dsh-comcode-quota/settings # whitelisted + range-checked; {reset:true} restores defaults
GET /api/dsh-comcode-quota/history # ?since=<ms>
POST /api/dsh-comcode-quota/history-clear
GET /api/dsh-comcode-quota/pricing # ?in=&write=&cache=&out= overrides the request profile; ?window=fiveHour|weekly|monthly picks the window for "requests left"
GET /api/dsh-comcode-quota/by-model # per-model usage (browser session)
POST /api/dsh-comcode-quota/by-model/refresh
POST /api/dsh-comcode-quota/by-model/probe
POST /api/dsh-comcode-quota/credentials/probe # re-read all four credential sources
GET /api/dsh-comcode-quota/diagnostics
Differences from the original
- Dropped: tray icon, floating widget, system notifications, launch-at-login, global hotkey, theme switcher, PNG export, demo mode
- Different: the price table is reparsed from the live pricing page by header name (not by column index), so a column reorder upstream cannot silently shift the numbers.
scripts/fetch-pricing.mjsregeneratesdata/goat-pricing.json. - Kept: Command Code API client, burn-rate and exhaustion projection, history sampling, pricing table and request-capacity estimate
- Added: in-panel polling every 20 s, visible credential source, range validation on every settable field
License
MIT, same as the original.