Introduction

When performing multi-turn conversations or agent workflows in DeepSeek Harness, costs are typically not solely determined by single outputs; they are also influenced by cache hits, cache reads, cache writes, and pricing during peak/off-peak hours. If you need to view the cost corresponding to token usage round-by-round within a session instead of just looking at a total, you need to project the usage timeline to the frontend and perform cost readings. Below is an introduction to the dsh-usage-cost plugin.

What is it

dsh-usage-cost is a DeepSeek Harness plugin used for real-time calculation of DeepSeek API costs per round of tokens per session, and automatically switching to peak/off-peak pricing starting from August 17th.

The repository address is:

https://github.com/Dino6021/dsh-usage-cost

The license is MIT.

Core Features

The plugin consists of two parts:

  1. Server-side session projection of usageTimeline: Token buckets for each assistant/message (miss / output / cache read / cache write), and recording completion timestamps.

  2. conversation.composer.dock slot usage-cost: Provides four segments of cost readings (Conversation / Workspace / Today / 5 Hours).

In terms of pricing logic, at midnight on 8/17 it automatically switches from flat-rate to peak/off-peak, determining peak/off-peak round-by-round based on timestamps. If there is no timeline (old sessions/missing projection), the plugin falls back to flat-rate pricing.

Installation and Enablement

The installation command is as follows, using the web profile, installing the main branch from the git source:

dsh plugin --profile web add "github:Dino6021/dsh-usage-cost#main"

This plugin adopts the official bundle form (dsh.bundle.patch + dsh.client), and the build artifacts are already in the repository, so no additional build is required when installing from the git source.

After executing the installation command, restart the web and refresh the page. After the above steps, a cost row will appear at the bottom of the conversation (below the statistics row).

Typical Usage

After installation is complete, you can see four segments of cost readings at the bottom of the conversation: Conversation, Workspace, Today, 5 Hours.

If you need to verify or adjust the unit price, you can edit the unit price definition at the top of lib/client.js. The steps to take effect after changing the price are as follows:

  1. Edit lib/client.js.

  2. Re-execute the installation command:

dsh plugin --profile web add "github:Dino6021/dsh-usage-cost#main"
  1. Refresh the page.

Pricing is based on official prices:

https://api-docs.deepseek.com/zh-cn/quick_start/pricing/

Note that cache write pricing is calculated based on the “cache miss” price; DeepSeek does not list a separate write price, so this bucket is often actually 0.

Installed plugins can also be managed using the thin console of plugin-registry, which is the browser panel.

Applicable Scenarios and Notes

Suitable for running on the DeepSeek Harness web interface for those who need to view costs for individual rounds, conversation, workspace, today, and 5 hours. If the session is old or the server-side projection is missing, the plugin will use flat-rate pricing as a fallback instead of retaining peak/off-peak pricing.

Notes before installation:

  • The plugin runs with the current dsh process permissions; you should check the source code and license before installing.
  • After installation, the web must be restarted and the page refreshed.
  • Unit price is maintained in lib/client.js at the top; it is recommended to compare with official prices before adjusting.
  • No build is required when installing from git source, but it is still recommended to confirm repository source code, dependencies, and license before installing.

Conclusion

The value of dsh-usage-cost lies in putting round-by-round token usage and cost readings into the DSH conversation interface, facilitating verification of actual costs after peak/off-peak pricing switches. The repository address is:

https://github.com/Dino6021/dsh-usage-cost