Introduction¶
In the DeepSeek Harness (DSH) web interface, developers have to manually check quotas and balances across different model providers by looking below the input box. This typically requires opening multiple tabs or navigating to each platform’s console, which interrupts the conversation flow. This plugin attaches MiniMax usage, DeepSeek wallet balance, and OpenCode Go quota directly to the composer’s dock, automatically switching the displayed content when you change the provider—reducing the cost of window-switching.
What This Is¶
x7user/dsh-model-quota is a DSH client plugin written by its maintainer, x7user. It displays each model’s usage and balance as pills beneath the chat input box, automatically switching views based on the provider selected in the current session. The plugin is split into a host-side half (index.js) and a page-side half (client.js): the host is responsible for requesting credentials from upstream and normalizing the data, while the page side handles rendering the pills and popovers.
Core Features¶
- Multi-provider support: MiniMax, DeepSeek, and OpenCode Go
- Pill display: Shows the percentage of usage consumed or the remaining balance amount, color-coded in three tiers (< 40% green, 40–75% orange, ≥ 75% red)
- Expandable details: MiniMax and OpenCode can expand to show window details and reset countdowns; DeepSeek balance is not expandable
- Auto-refresh: Refreshes automatically every 30 seconds; polling stops when switching providers
- Cache control: Successful responses are reused for
cacheMs(default 60 s);?refresh=1bypasses the cache
Installation & Enablement¶
Install from GitHub:
plugin_manager install_bundle target: github:x7user/dsh-model-quota
github: is a shorthand that pnpm recognizes. To pin a version, append a #, e.g. #v1.2.0 or a specific commit SHA. After installation, restart dsh web and then reload http://127.0.0.1:3080.
Install from a local directory (for development):
plugin_manager install_bundle target: E:\workspace\app\dsh-model-quota
The profile links to this directory rather than copying it, so editing client.js and refreshing the page is all you need to see changes.
Typical Usage¶
By default, the plugin mounts itself to the conversation.composer.dock slot, positioned to the right of the host’s built-in “Context” meter.
- MiniMax: Displays an icon, the current window, and the weekly usage percentage, e.g.
icon 5h 78% · week 22% - OpenCode: Displays an icon and the usage percentages for the 5-hour / weekly / monthly windows, e.g.
icon 5h 1% · week 0% · month 0% - DeepSeek: Displays a wallet icon and the balance amount, e.g.
wallet-icon ¥5.00
Click a pill to expand the details panel, which includes a “Refresh” button. Click outside the panel or press Esc to close it.
How It Works¶
The plugin has two halves: index.js handles routing and upstream requests on the host side, while client.js handles the pills and popovers on the page side.
Which view to show: The client reads the session’s modelSelection projection and matches the provider name via substring (case-insensitive /minimax/i, /opencode/i, /deepseek/i). Any other provider is neither rendered nor polled; if the projection is unavailable, it defaults to MiniMax.
How data reaches the page: The host resolves credentials through the composition’s credentials service, requests upstream, normalizes the response, and exposes it to the page via three same-origin routes:
| Provider | Upstream API | Page route |
|---|---|---|
| MiniMax | GET https://www.minimaxi.com/v1/token_plan/remains |
GET /minimax-quota[?refresh=1] |
| DeepSeek | GET https://api.deepseek.com/user/balance |
GET /deepseek-balance[?refresh=1] |
| OpenCode Go | GET https://opencode.ai/zen/go/v1/usage |
GET /opencode-quota[?refresh=1] |
All three use the API key already stored in Settings for each provider; no additional keys are persisted.
Percentage semantics:
- MiniMax returns
*_remaining_percent; usage consumed = 100 − remaining. The two numbers on the pill are the maximum across all models for the “current window” and “this week” respectively. - The OpenCode gateway directly sends the consumed
percent; the three windows correspond to rolling / weekly / monthly. - DeepSeek amounts are displayed verbatim as the decimal string returned by the API—no floating-point arithmetic is performed. When multiple currencies exist, the first wallet with a non-zero balance is shown.
Configuration¶
All options have sensible defaults. To customize, add a config: block to the corresponding entry in your profile’s cordis.patch.yml:
- id: model-quota
name: 'dsh-model-quota'
config:
apiKeyEnv: MINIMAX_CN_API_KEY
models: [general]
cacheMs: 60000
| Key | Default | Description |
|---|---|---|
apiKeyEnv |
MINIMAX_CN_API_KEY |
MiniMax credential reference name |
endpoint |
https://www.minimaxi.com/v1/token_plan/remains |
MiniMax endpoint |
deepseekApiKeyEnv |
DEEPSEEK_API_KEY |
DeepSeek credential reference name |
deepseekEndpoint |
https://api.deepseek.com/user/balance |
DeepSeek endpoint |
opencodeApiKeyEnv |
OPENCODE_GO_API_KEY |
OpenCode Go credential reference name |
opencodeEndpoint |
https://opencode.ai/zen/go/v1/usage |
OpenCode Go endpoint |
timeoutMs |
8000 |
Timeout per upstream request |
cacheMs |
60000 |
Reuse duration for successful responses (max 600000) |
warmOnStart |
true |
Warm up all three routes on startup |
models |
['general'] |
MiniMax quota bucket filter; [] shows all buckets |
Caveats¶
- Keys never leave the host: Credentials are resolved and used only in
index.js; they are never sent to the page nor cached client-side. - Modifying
index.jsrequires restartingdsh web. It is an ES module already imported by the host process; toggling the plugin or re-runninginstall_bundlewill not cause a reload (HMR ignores**/node_modulesand only watches the dsh install directory). Forclient.js, a page refresh is sufficient. - Video quota is hidden by default: MiniMax returns both
generalandvideobuckets. The defaultmodels: ['general']filters out the video bucket at the host level, so it never appears in the payload sent to the browser. To include it, change to[]or['video']—a restart is required. - Installing from GitHub does not auto-track upstream updates: The code is cloned into the profile’s
node_modules. To upgrade, runremove_bundlefollowed byinstall_bundle. - The pill cannot reach the right edge of the input box: This is determined by the host’s layout structure. The dock’s parent container is a column flexbox with
align-items: center; the dock itself has no explicitwidth, so the entire row shrinks to its content width and centers. As a result, techniques likemargin-left: autoorflex: 1within the slot have no effect. - The detail panel uses a
position: fixedoverlay: It anchors to the pill, flips below if there isn’t enough space above, and clamps within the viewport—so expanding and collapsing it never pushes the input box. - OpenCode Go’s usage API is undocumented: If fields change, the error falls through to
upstream-error; the panel shows the reason and the pill does not crash.
Verification¶
npm test # equivalent to node --test verify/host.test.mjs verify/client.test.mjs
verify/host.test.mjs: Drives the real host-side half using a fake composition, a fake ServerResponse, and a stubbed fetch—covering route registration, OpenCode window normalization, absent windows not being padded with 0, not-configured and upstream failure mapping, cache behavior with ?refresh=1 bypass, and trust-fence / method guards.
verify/client.test.mjs: Runs the real client.js inside a fake window, a minimal React hook runtime, and a stubbed fetch—covering routing and rendering for all four provider cases, failure and network-error paths, MiniMax remaining-percentage conversion, and non-matching providers not being rendered.
Neither test renders pixels; the actual on-screen positions and colors still need a quick visual check in a browser.
Use Cases & Ecosystem Context¶
This plugin is ideal for developers who need to check model usage and balances on the fly during a conversation. The plugin runs with the same permissions as the current dsh process; review the source code and license before installing.
The DSH philosophy is “everything is a plugin.” The community catalog is an independent site with no official affiliation to DeepSeek or High-Flyer.
Conclusion¶
This plugin centralizes usage and balance information from multiple platforms right next to the composer, reducing window-switching overhead. It’s a good fit for developers who frequently switch between providers. For more details and source code, see: