The DSH Web interface displays Session information and token usage by default. Developers often need to quickly understand the cost of a single conversation. The dsh-usage-dock plugin appends an amount-only pill to the stats pill row below the input box, providing a quick overview. It is maintained by aliensweety, categorized as a network tool, and licensed under the MIT license.
Core Features¶
The plugin primarily provides the following capabilities:
- Append a cost pill: Appends an amount-only pill after the official Session information and token usage pills. The three pills are displayed as a centered group, with styling consistent with the official pills.
- Two-tier cost display: Automatically calculates and displays the cost based on the current period (peak or off-peak). The expanded panel lists both peak and off-peak costs.
- Projection-based calculation: Uses DSH’s built-in
tokenUsageprojection for calculations. It does not read session log files, make network requests, or access any credentials. - Specific route and model support: Charges only for the
deepseek-officialroute. Automatically recognizesdeepseek-v4-proanddeepseek-v4.1-flash(includingdeepseek-flash) models and bills according to their respective price lists. - Click to view details: Clicking the cost pill opens the official token usage card, which additionally displays detailed information such as peak pricing, off-peak pricing, and cache hit rate.
Installation and Enablement¶
Install from GitHub (locking the version is recommended):
dsh plugin --profile web add github:aliensweety/dsh-usage-dock#v0.4.0
For local development, use a link install:
dsh plugin --profile web add D:\Ai\dsh\dsh-usage-dock
The dsh plugin add command writes the plugin into the profile’s dependencies and bundles configuration. After installation, patchReload is usually live, and hot mounting takes effect immediately; if it does not take effect, restart dsh web and hard-refresh the browser.
Usage¶
After installation, below the input box in the DSH Web interface, you will see the stats pill row become a group of three pills:
[ Session 信息 ] [ Token 用量 ] [¥ 0.47]
Clicking the amount pill expands the official token usage card, which includes the following information:
* Four token buckets: uncached input, cached reads, cached writes, and output.
* Totals and cost breakdown.
* Cache hit rate.
* Peak and off-peak costs.
Custom pricing: If you run the following command in the Web console, you can adjust the billing prices (effective for all priced models; fill the parameters with peak prices):
localStorage.setItem('dsh-usage-dock.pricing', JSON.stringify({ miss: 2, hit: 0.04, out: 8, write: 0 }))
Remove the key to restore the built-in prices.
Pricing Rules and Technical Details¶
- Pricing scope: Only the
deepseek-officialroute is priced. IflastUsed.provideris another route, the pill is not rendered. - Cached writes are not charged: The default charge is 0 because the official price sheet does not define a separate cached write price.
- Price tiers:
- Peak hours: weekdays 9:00–12:00 and 14:00–18:00.
- Off-peak hours: all other times (including nights and weekends), billed at half the peak price.
deepseek-v4-pro: peak input 9, cache hit 0.30, output 27; off-peak is half of these values.deepseek-v4.1-flash: peak input 2, cache hit 0.04, output 8; off-peak is half of these values.
- Estimated values: The amount is an estimate. If the model is switched mid-session or the session crosses a peak/off-peak boundary, the actual cost lies between the two price tiers shown in the panel; the pill displays only one tier based on the current time.
- Technical implementation: It does not rely on a React bundle; instead, it uses a virtual React injected by the host. Via
ReactDOM.createPortal, it renders the pill directly into the DOM of the official pill row, ensuring automatic alignment and spacing. If the official pill row cannot be found, the pill falls back to a centered standalone row.
Verification and Security¶
Verification steps:
1. Hard-refresh the interface in the browser where the plugin is installed (Ctrl+F5).
2. Three pills should appear below the input box, with the amount pill on the right (not rendered for an empty session).
3. Expand the pill and check the token buckets and cost details.
4. In the DevTools Network panel, verify that /plugins/dsh-usage-dock/client.js returns 200.
Security features:
* Does not read session log files.
* Does not access any credentials.
* Fail-safe: If the projection is missing, the route does not match, or required data is absent, the plugin fails silently and does not render, leaving no empty shell.
Uninstall¶
dsh plugin --profile web remove dsh-usage-dock