Preface¶
When connecting multiple subscription accounts in DSH simultaneously, the most annoying issue is not the lack of available models, but not knowing which one is about to run out. Switching to another account, or manually checking the remaining quota on various dashboards, interrupts the current task; waiting until the quota actually runs out to discover it often means a long task has already been running. This plugin puts quota information front and center next to the input box: no configuration changes needed, no API keys required. New accounts added to the Magpie gateway will automatically appear in the panel, and the remaining amount is visible at a glance.
Below introduces hongcheng-li/dsh-magpie-quota, a plugin running on the DSH client side, responsible for pulling quota and usage data reported by the local Magpie gateway to the right side of the DSH input box.
What is it¶
dsh-magpie-quota is maintained by Hongcheng-LI, positioned as a DSH client plugin. It directly reads the GET /v1/magpie/quotas and GET /v1/magpie/usage interfaces from the local Magpie gateway (a tray program, default listening on 127.0.0.1:3425). Therefore, the quotas presented in DSH come from Magpie’s unified view: subscription accounts like WorkBuddy, Trae, MiniMax, GLM, OpenCode Zen, Codex, and prepaid balance accounts like DeepSeek.
Magpie has unified these accounts into OpenAI-compatible interfaces. The plugin simply moves its quota data to the right of the DSH input box, so no extra configuration or independent authentication flow is needed.
The plugin’s current version is 0.4.2, licensed under MIT, and engines.node requires >=22.
Core Features¶
Summarized as a few things: a Usage/Quota badge next to the input box; clicking opens a double-column panel—the left column is a usage summary, and the right column is a detailed quota list per account; it also includes auto-refresh, theme following, and explicit hints for failed accounts.
-
Badge and Double-Column Panel
A fixedUsage/Quotabadge is displayed on the right side of the input box. Hovering shows the remaining percentage of each account and the current period’s cost. Clicking opens a double-column card: the left column “Current Usage” summarizes consumption, call counts, and input/output tokens, followed by a model usage ranking sorted by cost (each line starts with the source, e.g.,WorkBuddy · 542 calls · In 838.7K …, distinguishing the same model name under different accounts). The right column “Quota” lists windows and remaining percentage per account. -
Three Billing Methods
The numbers in the left column are displayed according to these three types: Subscription Credits (e.g.,84.1 credits), Pay-as-you-go Valuation (≈¥6.12, estimated at list price), and Prepaid Actual Deduction (¥6.12, such as balance accounts like DeepSeek). The plugin does not exchange currency rates or apply red/yellow/green thresholds; balance values are passed through as-is after formatting by Magpie. -
Quota List and Window Translation
The right column lists windows per account, with labels left-aligned and values right-aligned, for example:
MiniMax (China)
4 hours usage limit Remaining 95%
Weekly limit Remaining 33%
DeepSeek (Prepaid)
Balance ¥9.99
Magpie’s original window names are translated to Codex’s wording: 5 hours → 5 小时用量上限, 7 days → 每周限额, Credits → 额度, MCP · Month → 月度限额. Same-name handling applies to any N hours / N days, with the original name retained in the hover tooltip. The window order is fixed: short periods on top, long periods on bottom, regardless of the array order returned by Magpie.
-
Usage Period
Buttons on the right of the left column title allow selection ofToday/7 Days/30 Days/All. The selection is stored in thelocalStoragekeymagpie-quota-usage-period, defaulting to 30 days. -
Prepaid Balance Accounts and Top Balance Bar
Accounts withkind: "balance"(DeepSeek, AIHubMix, new-api relays, etc.) display “Balance ¥9.99” in bold large text in the panel, rather than a row of empty percentage. All prepaid balance accounts are summarized into one lineBalance DeepSeek ¥9.99under the title, so scrolling isn’t needed. The badge degrades toDeepSeek Balance ¥9.99when there is no percentage window. -
Failed Accounts
Magpie attaches probe errors to entries (fielderror, typical example:401 Unauthorized: … api key: ****6b92 is invalid). The plugin moves these accounts to the top, writes “Read Failed” in red in the top-right, and provides an actionable reason on the next line (e.g., “API key invalid (401), please update this account’s Key in Magpie”), with the full text in the hover tooltip. These accounts will not be displayed as “No balance provided”. -
Reset Cards and Free Accounts
Each card in Magpie’sresets.eachcontains a window and expiration time. The panel groups them by “Type + Expiration Date” into one line, for exampleReset Card 5 hours ×4 · Exp 11-22; 5 hours ×3 · Exp 12-22. Full resets are written asFull ×N, with hover showing the total count and specific dates.
Free accounts (containingFreein theplan/name in Magpie data, or from the built-in known list, such as Trae CN without the “Free” word) will have a gray(Free Account)suffix after the account name. -
Refresh, Color, and Theme
The panel auto-refreshes every 60 seconds; if the cache exceeds 15 seconds upon opening, it forces a fetch. There is a manual “↻ Refresh” at the bottom. The color button is in the top-right of the panel, cycling through Follow DSH → Light → Dark. The selection is stored in thelocalStoragekeymagpie-quota-card-theme(this key retains the old namemagpie-quotato avoid clearing preferences after renaming). The choice persists after refresh. When choosing Light/Dark, the card does inline overrides on its own--dsw-*variables, so even if the DSH theme is dark, the card can be fixed to light. Panel background, text, borders, shadows, and status colors all take DSH’s own design tokens (--dsw-alias-*), automatically consistent between light and dark. The panel is 860px wide, responsive to a single column on narrow screens, with a max height of 84vh and internal scrolling.
Installation and Enablement¶
The plugin requires Magpie to be running locally (default port 3425, can be overridden by the MAGPIE_URL environment variable). The two installation methods below are taken from the README.
# npm (recommended, fastest installation)
dsh plugin --profile desktop add dsh-magpie-quota
# Or install directly from GitHub
dsh plugin --profile desktop add github:Hongcheng-LI/dsh-magpie-quota
The npm package name is consistent with the GitHub repository name, both dsh-magpie-quota (the bare name dsh-magpie has been taken by someone else).
If doing local development, mount it as follows:
dsh plugin --profile desktop add "<absolute path to current directory>"
Then refresh the DSH page (or restart DSH) to see the badge on the right side of the input box.
The plugin is split into a browser half and a host half: dsh/index.js is registered on the DSH web server and is responsible for reading Magpie’s quotas and usage interfaces (quota cached for 15s, usage cached for 20s, only one in-flight request kept at a time; if Magpie is offline, the panel shows the error reason instead of blank); dsh/client.js is the browser half, responsible for the badge and popup panel on the right side of the input box. Changes to dsh/index.js require DSH to restart to take effect, while changes to dsh/client.js only require a page refresh.
The browser side requests /magpie/quotas and /magpie/usage via same-origin (Magpie’s own API does not include CORS headers, so the host half fetches on its behalf).
Typical Usage¶
After installing and refreshing the page, you can use DSH normally. To verify that the data is connected, perform a self-check using the port in the current page’s address bar; the host half does not require a login token:
curl.exe --noproxy '*' http://127.0.0.1:<current port>/magpie/quotas
You can view the styles without opening DSH by rendering a self-contained preview.html with real Magpie data:
node scripts/preview.mjs [output path]
If Magpie is not running, it renders the “Cannot connect to Magpie” offline state. To view the “Today” period, change usagePeriod in the script.
If you are using third-party relays like new-api / one-api, the plugin itself only reads Magpie. Whether a balance is displayed depends on whether Magpie has configured balance probing for it. You just need to configure it on the Magpie side; the panel will automatically display it without changing the plugin code:
# new-api / one-api relay (requires access token + user id)
magpie provider set my-relay balance=https://relay.example.com/api/user/self `
balance.path='$data.quota / 500000' balance.token=<access token> header.New-Api-User=<user id>
Supported keys for Magpie provider include balance=<URL> (balance query address), balance.path=<expression> (position of the amount in the response, can use + - * / and parentheses, $ or .. prefix to get signed value, % at the end to display as percentage based on 1), balance.method=GET|POST, balance.token=<token>, header.X-Foo=<v>. If the vendor simply does not provide a balance query interface, no tool can obtain the balance, and you can only fall back to viewing Magpie’s cost statistics: GET /v1/magpie/usage (30 days cost / credits / call count).
Applicable Scenarios and Notes¶
It is suitable for developers who already use Magpie locally to unify multiple subscription accounts and balance accounts into OpenAI-compatible interfaces and use these accounts in DSH. Its value lies in moving the question of “which one is about to run out” from memory to a constant piece of information next to the input box, allowing you to quickly scan before deciding which provider to use for long tasks.
Points to note:
- The plugin runs with the permissions of the current DSH process. The host half accesses local Magpie ports like
127.0.0.1:3425. Check the source code and LICENSE before installing (current version0.4.2, MIT license). - The data source is Magpie; it does not connect to cloud or third-party interfaces. If Magpie is not running, the panel displays the error reason rather than silently showing empty data.
- The description on the list page is client-side classification. The README also provides the npm package name and GitHub repository name, which are consistent.
- The repository comes with tests and syntax checks, fully offline, not depending on Magpie or DSH:
node --checkfor the two entry files,node --test tests/client.test.mjs tests/host.test.mjs(15 assertions), CI is in.github/workflows/ci.yml(Node 22, syntax + test + manifest validation).
Conclusion¶
This plugin solves a very specific problem: dispersed quotas for multiple accounts with no place to view them centrally. It connects Magpie’s already aggregated quotas and usage interfaces to the right side of the DSH input box with zero configuration, and new accounts automatically appear.
Directory: https://www.skillhub.cn/plugins/Hongcheng-LI/dsh-magpie-quota
GitHub: https://github.com/Hongcheng-LI/dsh-magpie-quota
npm: https://www.npmjs.com/package/dsh-magpie-quota