DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

miaomiao-r1 /

miaomiao-r1/dsh-vendor-quota

Verified

Vendor credits panel for DeepSeek Harness (DSH): sums every account remaining credits per vendor inside the model selector menu

★ 0 Stars0 Forks2 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@bc521334

dsh-vendor-quota

CI License: MIT

A read-only vendor credits panel for DeepSeek Harness (DSH): one line per vendor showing the sum of every account's remaining credits, how many accounts that total covers, and the credits expiring soon — right inside the model selector menu. Any plugin can add its own vendor row at runtime through the ctx.vendorQuota registration service; the four built-in adapters are only the starting set.

中文说明

Vendor credits panel

Where it appears

Open the model dropdown in the composer. In its root pane the Vendor credits panel sits after the Model and Effort cells and before the Agent Teams switch. It registers through the official conversation.input.model.options slot and does not take over the host's selector: search, keyboard navigation, reasoning effort and check marks stay the host's. If a future DSH release moves or removes that slot, the panel may stop drawing; the selector's own controls remain implemented by the host.

Where the numbers come from

Every data source is one entry in a declarative registry ({ id, label, read() }). The four connectors this panel was born with ship as built-in entries; any other plugin registers its own through the open service and its row appears with zero changes here. The panel reads only the HTTP endpoints the already-running connector plugins serve for their own panels. No vendor upstream is contacted and no credential is stored; the plugin does not modify vendor or account data. Its only local persistence is the credits snapshot described under Privacy.

Adding your own source (for plugin authors)

In your plugin's client half:

// ctx.vendorQuota — provided by dsh-vendor-quota
const off = ctx.vendorQuota.register({
  id: 'my-vendor',            // unique; re-registering an id replaces it
  label: 'My Vendor',         // shown as the row name
  read: async () => [         // per-account rows
    { credits: 12.5, expiring: 1.5 },
    { credits: 3 },
  ],
})
// off() unregisters

A read() rejection marks that source as failed (the footer counts it); rows without a readable credits count as accounts but contribute nothing to the total. Registrations made after activation join the next refresh (menu open past the 30 s threshold, the 45 s tick, or the Refresh button).

Not covered

DeepSeek's own account channels and self-configured channels (custom API keys, gateways): the DSH host does not expose their balances through any API this panel can read, so no line appears for them.

Label Source Field
Trae /plugins/dsh-connect-trae/usage?region=cn pool.accounts[].credits, expiringSoon
Trae Global the same, region=ai the same
CodeArts /api/codearts/status creditsByAccount[].credits.credits.total.remain, total.expiring
WorkBuddy /plugins/dsh-connect-workbuddy/account-credits?region=cn accounts[].credits, expiringSoon
WorkBuddy Global the same, region=global the same
Qoder /plugins/dsh-connect-qoder/account-credits?region=global [].credits
Qoder CN the same, region=cn the same

WorkBuddy deliberately does not read its usage endpoint: credits is frequently absent from pool.accounts[] in the global region, while account-credits reports a balance for every account.

A vendor that is signed out, not installed, or answering something unexpected simply loses its line. When nothing is readable and nothing failed, the panel does not render at all, so the menu never shows an empty box.

The account count reads n accounts; when some accounts have no readable balance it reads read/total accounts and the total covers only the readable ones, so a total that looks too small has a visible reason instead of a silent omission.

Install

Prerequisites. This plugin is a read-only aggregator over the DSH connector plugins. Install (and sign in to) the connectors you use first:

  • dsh-connect-trae
  • dsh-connect-codearts
  • dsh-connect-workbuddy
  • dsh-connect-qoder

Option A — from the local directory (development).

# DSH CLI or Plugin Manager → "Add plugin" → point at this directory
plugin_manager({ action: "install_bundle", target: "<path-to>/dsh-vendor-quota" })

Local directory installs are symlinks: edit the code here, restart the app, no reinstall needed.

Option B — from GitHub.

dsh plugin add https://github.com/miaomiao-r1/dsh-vendor-quota

Refresh behavior

The plugin reads one round when it loads and keeps it in memory (plus a copy in localStorage, so a full page reload starts warm), which usually means the first menu open already has numbers. After that, opening the menu re-reads only when the snapshot is older than 30 seconds, and even then the previous values stay on screen until the new ones land — no "Reading credits…" line in front of the user. Refresh in the panel's header rereads immediately, and an automatic read every 45 seconds is skipped while the page is hidden.

The host unmounts this slot entry every time the menu closes, so the snapshot lives at module scope rather than in component state; otherwise every open would wait on seven endpoints again. Concurrent reads join one round, so the warm-up at activation and the menu opening behind it cost a single set of requests.

Privacy

  • The panel reads same-origin local endpoints only — those the connector plugins already serve.
  • No vendor upstream request. No credential is stored, read or transmitted by this plugin.
  • The only persistence is the credits snapshot in localStorage (vendor names, totals, timestamp).

Known limitations

  • The panel is one slot entry in the host menu, pinned after the Model and Effort cells. It cannot be placed above them, and it cannot put a figure beside a provider heading: that heading is drawn by the host component and exposes no slot.
  • CodeArts' /api/codearts/status answers roughly 13 KB in about a second, slower than the other vendors. Each read round waits for all vendor requests to settle before updating the rows, so a slow CodeArts response delays the whole round.
  • Remaining credits only: no conversion to money and no estimate of how many requests remain.
  • Totals merge across accounts regardless of quarantine or expiry state — any account whose balance the endpoint still reports is counted.

Development

git clone https://github.com/miaomiao-r1/dsh-vendor-quota.git
cd dsh-vendor-quota
npm test        # offline harness: real / empty / hostile payload scenarios

The harness (dev/vq-test.mjs) stubs the module loader, React and fetch, renders the slot entry's whole tree and asserts the text the menu would show. Fixtures under dev/fixtures/ are fully synthetic.

Contributing

Issues and PRs are welcome — see CONTRIBUTING.md. By participating you agree to our Code of Conduct.

License

MIT © miaomiao-r1

—/ 5

No ratings yet

Verified DSH bundle

Commit bc5213346d94

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout