Introduction¶
DeepSeek Harness (DSH) adopts a modular design and encourages functionality extension through plugins. During development or debugging, it is crucial to monitor account balances and the cost of individual conversations in real-time. The dsh-deepseek-usage plugin aims to address this issue by displaying relevant data directly in the DeepSeek Harness sidebar and at the bottom of conversations.
Plugin Overview¶
Name: @blackthunder2191026/dsh-deepseek-usage
Maintainer: BlackThunder2191026
Positioning: Real-time sidebar balance display + per-turn conversation cost (CNY, with token breakdown).
Core Features:
* Sidebar Balance: Displays the DeepSeek account balance in the bottom left corner, refreshing every 60 seconds by default. Clicking allows expanding to show top-up balance / gift balance and manually refreshing; when the sidebar is collapsed into an icon bar, it displays as a colored status dot.
* Per-Turn Cost: Displays the cost in RMB for the specific turn in the info bar at the bottom of each conversation. Clicking allows expanding a three-column breakdown (Item / tokens / Unit Price).
Installation¶
The plugin has been published to npm with the package name @blackthunder2191026/dsh-deepseek-usage.
Method 1: Command Line Installation (Recommended)¶
npx @deepseek-ai/dsh plugin --profile desktop add @blackthunder2191026/dsh-deepseek-usage
The dsh process must be restarted after installation is complete.
Method 2: Graphical Marketplace Installation¶
Search for dsh-deepseek-usage in the marketplace search box.
Method 3: Install from GitHub Source¶
npx @deepseek-ai/dsh plugin --profile desktop add github:BlackThunder2191026/dsh-deepseek-usage
Note: If using pnpm, you may need to configure allowBuilds in pnpm-workspace.yaml, as the plugin includes a prepare hook (which only performs file integrity checks).
⚠️ Upgrade Notice¶
If you previously installed the old package without the scope, dsh-deepseek-usage, installing the new package will result in two sets of balance bars appearing. You must remove the old package before upgrading:
npx @deepseek-ai/dsh plugin --profile desktop remove dsh-deepseek-usage
npx @deepseek-ai/dsh plugin --profile desktop add @blackthunder2191026/dsh-deepseek-usage
Configuration and Billing¶
Configuration Items¶
The configuration file is located at cordis.patch.yml in the profile, with the line id deepseek-usage. It requires full replacement rather than a deep merge.
- id: deepseek-usage
name: dsh-deepseek-usage
config:
apiKeyEnv: DEEPSEEK_API_KEY
currency: CNY
balanceTtlMs: 30000
defaultModel: deepseek-flash
maxTurns: 300
models:
deepseek-flash:
hit: { peak: 0.04, offPeak: 0.02 }
miss: { peak: 2, offPeak: 1 }
output: { peak: 8, offPeak: 4 }
deepseek-v4-pro:
hit: { peak: 0.3, offPeak: 0.15 }
miss: { peak: 9, offPeak: 4.5 }
output: { peak: 27, offPeak: 13.5 }
Billing Logic¶
- Pricing Basis: Sourced from the official DeepSeek Chinese pricing page, in Yuan per million tokens.
- Calculation Formula:
Cost (CNY) = Cache Miss Input × miss price + (Cache Hit Input + Cache Write) × hit price + Output × output price
- Peak/Off-peak: Peak hours are 09:00-12:00 and 14:00-18:00 from Monday to Friday; all other times are off-peak. Peak rates are double the off-peak rates.
- Scope of Application: Only finished turns are billed.
Notes and Environment Requirements¶
- Environment Requirements:
- dsh: Must use a profile with a Web interface (
desktoporweb);headlessorSDKprofiles are invalid. - Node.js: Host version must be >= 22.19.
- Credentials: Requires
DEEPSEEK_API_KEYfor the official DeepSeek provider (environment variable or~/.dsh/.credentials.yaml).
- dsh: Must use a profile with a Web interface (
- Platform Support: Contains no platform-specific code; supports Windows / macOS / Linux.
- Runtime Dependencies: Zero runtime dependencies; the host side does not import any packages, and the client side only depends on dsh’s
react. - Debugging:
- Changes to host-side code require restarting dsh.
- Changes to client-side code require refreshing the page (Ctrl+F5).
FAQ¶
- Two sets of balance bars appear: The old version
dsh-deepseek-usageand the new version@blackthunder2191026/dsh-deepseek-usageare installed simultaneously. Please follow the upgrade steps above. - No balance row in the sidebar: Check if the profile has a Web interface; or check the response from
curl "http://127.0.0.1:<port>/deepseek-usage/summary?debug=1". - Balance display unavailable:
DEEPSEEK_API_KEYis not configured or the official DeepSeek provider is not being used. - Installation fails with a message saying only npm packages can be installed: Some clients only accept
package_name@exact_version. Please use Method 1 or Method 4.
Conclusion¶
This plugin provides the cost monitoring capabilities needed by DeepSeek Harness developers, displaying balances and details directly within the official client interface. For more details and source code, please refer to the Project Homepage.