Introduction¶
DSH Desktop (DeepSeek Harness) sidebar page: Clearly separates two things—how much official balance each service still has, and where the local DSH spent its money this month (ledger + session stats, marked as “estimated”).
The plugin is named dsh-usage-panel, maintained by fengnowuyu-beep, categorized under admin-security, current version 0.5.5.
Feature Overview¶
Sidebar Entry¶
The “Usage” row in the sidebar; clicking it opens the full panel.
Cross-Service Summary Bar¶
Local DSH monthly total + each service’s monthly consumption (ledger basis, marked as “estimated”); ledger last-updated time.
Official Balance Cards¶
Data comes from each service’s official API; source indicator shown in the bottom-right corner of the card.
DeepSeek Card¶
Official balance (total / gift credits / top-up); multi-currency main figure defaults to CNY, other currencies listed separately.
MiniMax Card¶
- Subscription Key: Token Plan 5-hour / weekly quota
- Pay-as-you-go Key: Account balance (auto-detected, no fake percentage displayed)
Alibaba Cloud Card¶
BSS QueryAccountBalance: Available Amount / Cash Balance / Credit Control Quota / MYbank Credit / Quota Limit.
Custom Data Source Card¶
Up to 8 sources; manual URL + request headers + JSON value path; header Token stored only on Host; extracted value must be numeric.
Threshold Alerts¶
Set thresholds per service / custom source; marked red only when strictly below threshold; optional desktop notification (Notification API, once per day).
Ledger Details¶
When expanded, shows: monthly spend / calls / Tokens / today’s overview; 7-day trend + daily calls & consumption; per-model breakdown of Tokens, calls, cost, and percentage; per-session Top 20 ranking with percentage, scrollable.
Per-Session Stats (Lazy Loading)¶
When details are expanded, scans this month’s session logs and estimates each session’s cost / calls / Tokens using the built-in pricing table; returns only titles and numbers.
Sidebar Alerts¶
Top-right corner of the “Usage” icon: red dot = balance at zero, orange dot = below configured threshold; updates on panel open / snapshot refresh; no background polling.
Platform Links¶
Each built-in service card (including unconfigured state) has an “Open Platform ↗” button that opens the official console in a new tab; Alibaba Cloud uses the China site billing-cost.console.aliyun.com; not available for custom sources.
Multiple Keys¶
Up to 4 keys per built-in service: primary Key + up to 3 additional Keys; each additional Key has its own balance/quota row; no per-key request consumption is fabricated.
CSV Export¶
Three CSV files: Balance / Ledger / Sessions; UTF-8 BOM + CRLF; Keys exported as masked only.
Manual Refresh¶
Page header refreshes all; each card’s “Test Connection” tests only itself.
Key Masking¶
Page only receives the masked value; plaintext exists only on the Host side.
Graceful Degradation on Failure¶
5-second timeout + per-service error state; if a cache exists, displays stale value with a “Cache” label; one service’s failure does not affect other cards.
Settings Page¶
Five tabs: three services, alerts, custom data sources; each service includes additional Key management.
Installation & Activation¶
It is not installed for you automatically (installation modifies the profile and requires confirmation).
Option A: Plugin Manager¶
DSH → Settings → Plugins → Install, enter:
E:/Data/Project/DeepSeekHarness/DSH-Homemade-Plugins/dsh-usage-panel
Option B: Manual Registration¶
~/.dsh/profiles/desktop/package.json:
{
"dependencies": {
"dsh-usage-panel": "file:E:/Data/Project/DeepSeekHarness/DSH-Homemade-Plugins/dsh-usage-panel"
},
"dsh": {
"profile": {
"bundles": [ /* …existing entries… */ "dsh-usage-panel" ]
}
}
}
Then run cd $HOME\.dsh\profiles\desktop; pnpm install and restart DSH.
Configuration (Per Service)¶
Open “Usage” → card or settings page → select the corresponding service tab.
DeepSeek¶
| Field | Description |
|---|---|
| API Key | Created on the DeepSeek Open Platform, starts with sk- |
| API Base URL | Default https://api.deepseek.com, change only when using a proxy |
After saving, click “Test Connection” on the card to verify. The balance API only answers “how much is left” and does not provide consumption data.
MiniMax¶
| Field | Description |
|---|---|
| API Key | Subscription Key (Token Plan) or Pay-as-you-go API Key (PAYG) |
| Region | Mainland China www.minimax.cn / International www.minimax.io, select based on the Key’s originating site |
The same field now supports both key types:
- Subscription Key: Queries
GET /v1/token_plan/remains, card displays 5-hour/weekly quota percentage. - Pay-as-you-go Key: When the subscription API returns no-plan/rejected, automatically falls back to
GET {api-base}/account/query_balance, card displays “PAYG Balance ¥X / $X”. - Domestic API base:
https://api.minimaxi.com - International API base:
https://api.minimax.io - The balance endpoint is a community-verified path, not prominently documented in MiniMax’s public docs; real keys have not been tested in this project.
Pay-as-you-go Keys do not show token consumption details: The balance API only returns the account balance; the console’s billing history is a web session API requiring Cookies, not part of this plugin’s integration.
Alibaba Cloud (RAM Sub-account)¶
- Create a sub-account in the RAM console; do not use the primary account’s AccessKey;
- Grant read-only permission
bss:DescribeAcccount(BSS OpenAPI account balance query permission); - Generate the sub-account’s AccessKey ID + Secret and enter them in the panel;
- Endpoint defaults to
business.aliyuncs.com, generally no need to change.
The panel displays fields like Data.AvailableAmount; Success=false or authentication failures show the specific error (invalid AccessKey / signature failure / insufficient permissions) and will not display a fake balance.
Threshold Alerts¶
“Service Settings → Alerts”:
- Set thresholds independently for DeepSeek balance, MiniMax balance/remaining percentage, and Alibaba Cloud available amount;
- Custom data sources can also have thresholds set;
0or empty = no alert; only strictly below the threshold triggers red (equal does not trigger);- Turning off “Enable Threshold Alerts” disables all thresholds;
- Sidebar icon dot: Red = balance at zero (independent of the alert toggle); Orange = below the configured threshold for that card (requires threshold alerts enabled and threshold > 0);
- The dot updates only on a one-time snapshot when the panel is opened/refreshed or the client mounts; no background polling.
- “Desktop Notification” is off by default: uses the browser / Electron
NotificationAPI; the same service + same threshold only notifies once per day; if the system denies or the API is unavailable, silently falls back to page-level red marking without affecting the panel.
Custom Data Sources¶
“Service Settings → Custom Data Sources”:
- Fill in name, URL, JSON value path (e.g.,
data.balance,items[0].amount), and currency; - Request headers, one per line as
Name: Value(e.g.,Authorization: Bearer …); after saving, the page only shows name + mask; leaving empty during edit means keep the original header; - Auto-refreshes once after saving; up to 8 sources.
Constraints: http/https only; URL must not contain username/password; GET method; 5-second timeout; response JSON ≤ 1 MB; headers prohibit CR/LF, Host, Content-Length, and other reserved headers; non-numeric extracted values show an error and will not default to 0. Headers may contain Tokens, so the entire custom source configuration is stored in a Host-private file, not in settings.json.
Multiple Keys¶
“Service Settings → DeepSeek / MiniMax / Alibaba Cloud → Additional Keys”:
- Up to 4 keys per service: primary Key (the original single Key field) + up to 3 additional Keys;
- Additional Keys take a label + key (Alibaba Cloud: AccessKey ID + Secret); auto-queries once after saving;
- The card’s main figure remains the primary Key; additional Keys display their own balance/quota/status in a table below;
- One additional Key failure only affects its own row, not the primary Key or other rows;
- Credentials file upgraded to v3; old v2 single-Key format is auto-compatible, no keys will be lost.
Basis: DeepSeek/Alibaba Cloud balances are account-level; multiple Keys for the same account will display the same balance; the official API does not provide per-key request consumption, and the local ledger does not record which Key was used. Therefore this plugin only shows per-Key balance/quota, not “per-Key consumption” breakdown; alerts still reference the primary Key.
CSV Export¶
Three links at the bottom of the page:
- Export Balance CSV: One row per Key (service, label, mask, status, balance/quota, alert, timestamp);
- Export Ledger CSV: Last 7 days daily rows + per-model rows;
- Export Sessions CSV: This month’s session titles, calls, Tokens, estimated cost, unpriced calls.
Encoding is UTF-8 BOM + CRLF, directly openable in Excel; fields escaped per RFC 4180; only Key masks are exported, no plaintext Keys/headers. Session titles may contain business information; please confirm the save destination before exporting.
Storage & Alternatives¶
| File | Content |
|---|---|
~/.dsh/usage-panel/credentials.json |
v3: Primary Keys for three services + extraKeys (includes plaintext, Host-only); created with 0600 (on Windows, chmod is best-effort; actual protection via user directory ACL) |
~/.dsh/usage-panel/settings.json |
Non-sensitive config: DeepSeek baseUrl, MiniMax region, Alibaba Cloud endpoint, alert thresholds/toggles, timeout, etc. |
~/.dsh/usage-panel/custom-sources.json |
Custom data sources (including header values), 0600; added to .gitignore |
~/.dsh/usage-panel/balance-cache.json |
Last successful results for each service / additional Key / custom source (fingerprint only, no Key/header values) |
Credentials file structure: examples/credentials.example.json; settings: examples/settings.example.json; custom sources: examples/custom-sources.example.json.
Environment variable alternative (both must be provided to take effect):
DEEPSEEK_API_KEY
MINIMAX_API_KEY
ALIYUN_ACCESS_KEY_ID + ALIYUN_ACCESS_KEY_SECRET
Credentials provided via environment variables cannot be “cleared” from the page (API returns key-from-env). The plugin does not read ~/.dsh/.credentials.yaml.
Use Cases & Notes¶
Suitable for DSH Desktop users who need to monitor balances across multiple services (DeepSeek, MiniMax, Alibaba Cloud) and local usage simultaneously.
The plugin runs with the current DSH process permissions; check the source code and license (MIT) before installation.
Summary¶
dsh-usage-panel provides DSH Desktop with a dual-basis summary view of official balances and local ledger, supporting multiple services, multiple Keys, custom data sources, threshold alerts, and CSV export. It is well-suited for developers and teams requiring fine-grained cost control.
Links¶
- Plugin directory page: https://www.skillhub.cn/plugins/fengnowuyu-beep/dsh-usage-panel
- GitHub: https://github.com/fengnowuyu-beep/dsh-usage-panel