When using DeepSeek Harness (DSH) for agent development or daily conversations, real-time monitoring of token usage and cost is crucial. DeepSeek’s official peak/off-peak pricing strategy can be error-prone and unintuitive to calculate manually. The following plugin monitors session token usage in real time, strictly aligns with official pricing to calculate costs, and can generate a whale ASCII billing receipt in the TUI status line or through the /billing command.
Plugin Introduction¶
Maintained by ethanz11-creat, this plugin’s core value lies in bringing DeepSeek’s peak/off-peak billing logic into the DSH environment. It displays costs in real time and can generate a visually styled cashier-style bill, with support for Agent tool calls.
Core Features¶
- Peak/off-peak billing: Strictly aligned with DeepSeek’s official pricing page; full price during peak hours and 50% off during off-peak hours.
/billingcommand: Persistently prints a whale ASCII billing receipt in the TUI conversation flow.- TUI status line: The status bar displays the current session’s cumulative cost and peak/off-peak status in real time.
- Agent tools: Provides
show_billing(check costs) andcheck_pricing_period(check the current peak/off-peak period). - Session inheritance: When forking a new session by switching models, it inherits the parent session’s usage.
- Deduplication to prevent stacking: Repeated
/billingcommands with no new input/output will not print the receipt again. - DeepSeek models only: Recognizes only
deepseek-v4-flash/deepseek-v4-pro; other models returnnull.
Installation and Enablement¶
The plugin is installed through the bundle mechanism of dsh plugin. After installation, it is ready to use out of the box, with no additional configuration required.
dsh plugin --profile demo add dsh-billing-tui
Usage¶
After installation, you can use it in the following ways:
1. Run /billing in the conversation flow to print the billing receipt.
2. View the cost displayed in real time in the TUI status line.
3. Agent calls the show_billing tool to query costs.
4. Agent calls the check_pricing_period tool to query the current period.
Pricing and Rules¶
The plugin strictly aligns with DeepSeek’s official pricing page. The unit is CNY / million tokens. Peak hours are 9:00–12:00 and 14:00–18:00 Beijing time (daily, including weekends); all other times are off-peak, priced at 50% of peak.
The billing logic includes:
* Cache hits: Corresponds to prompt_cache_hit_tokens returned by the DeepSeek API.
* Reasoning tokens: Merged with output tokens and billed at the output tier.
* Model support: Only deepseek-v4-flash and deepseek-v4-pro are billed; other models (such as Claude or GPT) or unknown model identifiers return null and are not billed.
Notes¶
- Time zone: Period determination uses the fixed
Asia/Shanghaitime zone and does not depend on the local machine time zone. - Optional configuration: In
cordis.patch.yml, you can configurecurrency(default CNY) andpricing_source(default deepseek_official).
Ecosystem Context¶
The philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” This plugin is a community plugin and has no official affiliation with DeepSeek or High-Flyer.
Repository: https://github.com/Ethanz11-creat/dsh-billing-tui