In the development environment of DeepSeek Harness (DSH), real-time monitoring of API call counts, token consumption, and account balance is necessary. Checking manually in the web interface is not only inefficient but also easily disrupts the workflow. The dsh-deepseek-usage plugin integrates DeepSeek platform usage data into the DSH web interface sidebar, providing a unified monitoring entry point.
This plugin is maintained by community developer scientisbo and follows the MIT license. It reads public and private Dashboard interfaces of the DeepSeek platform to generate a local visual usage panel.
Core Features¶
- Account balance and usage display: Shows account balance, today’s/month’s token count, cost, request count, cache hit/miss status, and top model ranking.
- Visual heatmap: Provides a daily usage heatmap with monthly pagination and single-day details.
- Sidebar integration: Provides an entry at the bottom of the sidebar, with a badge showing the current balance; clicking it opens a floating panel, and when the sidebar is collapsed it becomes a circular icon button.
Installation and Enablement¶
Use the following command to install the plugin. If installing from a file, replace the path with the actual file path.
dsh plugin --profile web add "file:/绝对路径/dsh-deepseek-usage"
# 或者发布到 npm 后:dsh plugin --profile web add dsh-deepseek-usage
After installation, restart dsh web and hard-refresh in the browser (Ctrl+Shift+R). A “DeepSeek Usage” entry will appear at the bottom of the sidebar.
Configure Credentials¶
The plugin relies on two credentials: API Key for fetching balance, and Platform Token for fetching platform usage details.
| Data Type | Credential Name | Description |
|---|---|---|
| Balance | DEEPSEEK_API_KEY |
Reads the ref by default; you can specify apiKeyRef in the config |
| Platform usage | DEEPSEEK_PLATFORM_TOKEN |
Reads the ref by default; you can specify platformTokenRef in the config |
Obtain userToken¶
- Log in to
https://platform.deepseek.comin your browser. - Open browser DevTools (F12) and go to the Application tab.
- Find the
platform.deepseek.comdomain under Local Storage. - Copy the value of
userToken.
Configuration Methods¶
- Paste in panel: Paste the userToken directly in the “Configure session token” area of the plugin panel (recommended, takes effect immediately).
- Write to config file: Write the following in
~/.dsh/.credentials.yaml:
refs:
DEEPSEEK_PLATFORM_TOKEN: <userToken>
If userToken is not configured, the panel still displays the balance, and the usage area provides configuration guidance.
Optional Configuration¶
By using insert entries in cordis.patch.yml, you can adjust the plugin’s runtime parameters.
- insert:
- id: deepseek-usage
name: dsh-deepseek-usage
config:
apiKeyRef: DEEPSEEK_API_KEY # 默认
platformTokenRef: DEEPSEEK_PLATFORM_TOKEN # 默认
refreshMs: 300000 # 服务端缓存 TTL,默认 5 分钟
timeoutMs: 15000 # 上游请求超时,默认 15s
Interfaces and Security¶
The plugin has two built-in server-side endpoints for data retrieval.
| Endpoint | Description |
|---|---|
GET /api/deepseek-usage/summary?month=&year= |
Balance + usage aggregation for the specified month (cached) |
GET /api/deepseek-usage/refresh?month=&year= |
Force refresh the data above |
Security Notes:
* The server-side endpoints only accept GET requests from localhost.
* userToken is only stored in the browser’s localStorage, only sent in request headers to the local dsh service, and is never persisted to disk.
Ecosystem Background¶
The core philosophy of DeepSeek Harness is that “everything is a plugin”. This plugin relies on the DeepSeek Harness web client environment to run. As an independent project in the community catalog, it is not affiliated with DeepSeek or the official High-Flyer project and is maintained by the open-source community.