Introduction¶
DeepSeek Harness (DSH) is a development platform for building agents. During development and debugging, real-time visibility into API call costs helps control budgets and optimize prompts. Official billing often has delays and does not provide fine-grained cost feedback during development. This article introduces the dsh-api-cost plugin, which calculates and displays costs in real time based on local session logs.
What Is This¶
dsh-api-cost is a client plugin for DeepSeek Harness, maintained by developer CCCq-C and released under the MIT License. It calculates API usage costs from local session projections and runs independently without modifying the host repository.
Core Features¶
The plugin mainly provides the following capabilities:
- Real-time cost display: Shows a “cost chip” above the browser input bar that updates the current API consumption in real time.
- Session projection: Based on the
apiCostprojection from session logs, it calculates and displays the cost of each sample. - Configurable rates: Supports configuring a rate table in USD per million tokens (USD/M tokens) and supports overriding default rates for specific models.
- Bilingual UI: The interface supports Chinese and English and follows the host language setting.
- Standalone plugin: As an independent plugin package, it is injected via
cordis.patch.ymlwithout intruding into host code.
Installation and Enabling¶
Install it using the official CLI:
dsh plugin --profile web add dsh-api-cost
After installation, restart the dsh web service. The loader will automatically apply the configuration in the plugin package. Then send a message in any session, and the cost chip will appear above the input bar.
Typical Usage¶
After enabling the plugin, sending a message shows a real-time display similar to API cost $0.0023 1.2K + 3.4K tok above the input bar, including total cost, input Token count, and output Token count.
If you need to adjust rates or currency, edit the configuration file $DSH_HOME/profiles/web/cordis.patch.yml and add a config field to the api-cost line. The configuration structure usually includes the currency type, default rates, and override settings for specific models.
Use Cases and Notes¶
This plugin is suitable for DSH users who need to monitor costs immediately during development.
Keep the following points in mind when using it:
- Estimation differences: The cost is an estimate based on local session logs and may differ from DeepSeek official billing. This may be due to official caching policies, price changes, or model renames.
- Billing after model switching: If you switch models in a session, subsequent usage samples are billed at the rate of the model after switching.
- Subagent cost displayed separately: Subagents have independent session IDs, and their costs are not aggregated into the parent session’s cost chip.
Conclusion¶
dsh-api-cost provides DSH developers with a lightweight cost monitoring tool. Through local calculation and flexible configuration, it helps control costs during development. For more details, refer to the plugin directory or GitHub repository.