DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture. The dsh-sub2api-usage plugin integrates Sub2API’s balance and usage information into the left sidebar of DSH, allowing users to view it without opening the site in a browser. It supports multiple query modes, and all requests are issued by the host process, so the site does not need to configure CORS.
Features Overview¶
The plugin provides a persistent balance bar in the left sidebar. Clicking it opens a panel containing detailed data.
- Sidebar Display: Displays a balance summary (e.g.,
$12.34 Usage) at the bottom of the left sidebar, accompanied by a status dot. A yellow dot indicates the balance is below a threshold, while a red dot indicates it is not configured. - Detail Panel: Clicking the bar or icon reveals a full usage panel, including wallet balance, remaining quota, subscription period, hourly/daily usage trend line charts, model usage, and rate limit windows.
- Custom Interface: Every part of the query interface (service address, mode, path, JSON pointer) can be customized.
- Query Modes: Supports various authentication methods, including Site Key, Admin Key, account/password login, and fully custom requests.
- Data Visualization and Export: Supports switching trend charts by hour or day, and allows exporting data as CSV or JSON.
- Real-time Refresh: Automatically refreshes the balance in the background at a set interval (default 120 seconds).
Installation and Prerequisites¶
Prerequisites:
* DeepSeek Harness (DSH) environment, with dsh available in the command line.
* Node.js version ≥ 18.
Installation:
dsh plugin --profile desktop add github:aming1029/dsh-sub2api-usage
After installation, the plugin manager applies the changes immediately; no application restart is required.
Configuration and Usage¶
- Open the DSH client and find “Sub2API Usage” in the balance bar or icon area at the bottom of the sidebar.
- Click to enter the panel and switch to the “Settings” tab.
- Configure the service address and credentials in the “Query Interface” section.
- Select the appropriate query mode and save. Click “Test Connection” to verify the configuration.
Supported Query Modes:
* Site Key: Suitable for querying the balance and usage of a specific key.
* Admin: Uses an Admin API Key to query the balance, frozen balance, total recharge amount, etc., for a specified user or a list of users.
* Account & Password: Logs in with an email and password to query information for the currently logged-in account.
* Custom Request: Manually specify the request method, path, headers, and body.
Advanced Features and Notes¶
- Hourly Data Sampling: For interfaces that only return daily data, the plugin utilizes background sampling logic to calculate hourly usage locally, retaining data for the last 14 days.
- Host-Initiated Requests: All requests to the upstream site are issued by the DSH host process (Node.js side); the page does not directly request the site interface. This means the site does not need to enable CORS, and credentials will not appear in the page code.
- Configuration Persistence: Settings (including refresh intervals, default views, statistical ranges, etc.) are saved to the configuration file.
Conclusion¶
This plugin provides developers using Sub2API with a real-time monitoring panel integrated into DeepSeek Harness. All functions are handled on the host side, ensuring the stability and privacy of data retrieval.
- GitHub Repository: https://github.com/aming1029/dsh-sub2api-usage
- Plugin Directory: https://www.skillhub.cn/plugins/aming1029/dsh-sub2api-usage