Introduction¶
DeepSeek Harness itself does not have currency-based billing capability. As DeepSeek adjusted its pricing in 2026 and introduced peak/off-peak pricing, developers need a tool to track the actual cost of each model call. visol-456/dsh-cost-tracker listens to model call completion events, calculates costs based on the token usage reported by the provider, and persists the records.
Core Features¶
- Listening and cost calculation: Listens to call completion events and calculates costs in real time based on the token usage returned by the provider (input, output, cache hits, cache misses) and the price table.
- Data persistence: Saves each call record to a local file.
- Statistics dashboard: Provides a three-tier UI.
- Call-level details: Displays the cost of the current call in the conversation trajectory statistics row.
- Session-level summary: Displays the total cost and cache hit rate in the “Session Summary” card within the same statistics band.
- Global statistics page: Provides key metric cards, detailed metric cards, a trend line chart, and Request Logs / Provider Statistics / Model Statistics tabs.
- Peak/off-peak pricing: Supports configuring prices for different time periods, adapting to DeepSeek’s peak and half-price strategy.
Installation and Enablement¶
- Install via npm:
npm i @visol-456/dsh-cost-tracker
- Mount the plugin in
cordis.yml(bare-metal Node deployment):
- name: '@visol-456/dsh-cost-tracker'
config:
dataDir: /path/to/cost-records # 可选,默认为 <DSH_HOME>/cost-tracker
- Install into the web profile (recommended):
dsh plugin --profile web add @visol-456/dsh-cost-tracker
Typical Usage¶
- Configure the price table: In the “Usage Statistics” section of the conversation page, enter “Price Configuration”, modify the price table to support peak/off-peak pricing, or directly modify the
pricesconfiguration incordis.yml. - View data: Visit the “Usage Statistics” tab on the conversation page to view cost trends and detailed logs.
Notes¶
- Compatibility: Compatible only with DeepSeek Harness 0.1.5-rc.1.
- Pure Node operation: If no
webServeris present, the plugin can still run in pure Node mode and record data, except that the UI is unavailable. - Data storage: The data file is stored by default at
<DSH_HOME>/cost-tracker/records.l. - Plugin positioning: This is a “metering/billing” plugin. It records the actual serving provider/model, and is used in combination with the
dsh-llm-fallbacksplugin, which handles “routing/failover”.
Conclusion¶
This plugin provides cost monitoring capability for DSH developers. Its design is inspired by the Usage Statistics page in CC Switch, and it implements lightweight statistics through hand-drawn SVG charts. For more details and source code, visit GitHub.