dsh-turn-cost-pill: Display "Previous round cost" next to the input box

Introduction

When developing agents using DSH, a single task may involve multiple steps and multiple model requests. To know “how much was spent in this round just now,” one typically has to scroll through session logs, manually extract the usage for each request, and calculate the cost by referencing the price list. This plugin solves this problem: it displays the RMB cost of the latest interaction directly to the right of the “Permissions” button in the input box.

The plugin is maintained by ly13277, source code repository ly13277/DshRmbCostPer1Talk, categorized under Model Inference, and the repository package name is dsh-turn-cost-pill. The meaning is straightforward: the total cost of the latest interaction (since your last message) in this round.

Display Status: This Round and Last Round

After a round completes, the capsule displays “Last ¥0.0123”; while this round is still running, it displays “This Round ¥0.0041” along with a green dot, and the amount grows in real-time with the settlement of every step request. In other words, you don’t need to wait for the entire round to finish to see the accumulated cost.

Hovering the mouse also reveals details: uncached input, cache hits, output token count, and the actual model used.

Data Source and Pricing Basis

This plugin does not initiate model requests itself, nor does it collect or upload data. It reads the billing usage reported by the provider in the session logs for every billing request:

  • Token Source: Usage from assistant/message / assistant/attempt for each billing request, aggregated by “round + step”; retry billing attempts are also counted.
  • Price: Based on the DeepSeek official price list (RMB / million tokens). During idle time, Flash is 0.02 for cache hits, 1 for uncached input, and 4 for output; Pro is 0.15 / 4.5 / 13.5. During peak hours (Beijing time weekdays 09:00–12:00, 14:00–18:00, excluding statutory holidays), the price is multiplied by 2.
  • Cache Write: Calculated based on the uncached input price; the amount is rounded to 6 decimal places before display.
  • Unknown Models: Non-official DeepSeek models lack a built-in price list and will fall back to the Flash price, marked with ≈ to avoid treating the estimate as an exact value.

The price list and holiday table are written at the top of index.js; just update this section after an official price adjustment.

Installation and Activation

The installation command is as follows, replace owner with ly13277, the owner of this repository:

dsh plugin --profile web add github:ly13277/DshRmbCostPer1Talk

After installation, refresh the page; you will see the amount capsule in the input box toolbar, positioned to the right of the “Permissions” button.

To uninstall, use the command name dsh-turn-cost-pill:

dsh plugin --profile web remove dsh-turn-cost-pill

Code Structure

The plugin works in coordination between two halves: the Host side only registers a session projection, while the Browser side is responsible for rendering the capsule:

File Function
index.js Host side: registers the session projection turnSpend, converts usage per round into an amount (wire.view).
client.js Browser side: registers the amount capsule in conversation.input.left (right after the Permissions/Schedule buttons).
cordis.patch.yml Inserts the turn-cost-pill Loader row into the profile.
locale/*.json Title and description for the plugin management page.
icon.svg / assets/icon-180.png Plugin icon and marketplace card icon (original).

Use Cases and Notes

Suitable for developers who want to monitor costs anytime during debugging without having to check logs every time, particularly in pay-as-you-go scenarios where cost attribution matters.

Three points need to be noted:

  • This plugin runs with the permissions of the current dsh process and will write data to the user home directory, credential directory, and project directory. Before installing or enabling it, please check the source code and license (this repository uses the MIT license) to confirm you understand its permission scope.
  • The amount is an estimated value converted based on the DeepSeek official price list, not the original bill value; actual billing is based on the DeepSeek bill.
  • It only counts token costs for model requests and does not include per-item billing items like image attachments (DeepSeek currently does not have such items).

Additionally, if a provider does not report usage (e.g., the request is forcefully killed mid-process), this step will not appear in the amount—there is no available billing data in the session log, which is a data source gap.

Summary

The value of this plugin lies in extracting “how much was spent this round/last round” from manual log calculation and turning it into a persistent, instant reading next to the input box; the data comes from the usage reporting already present in the session logs. See the directory page at skillhub.cn plugin page and the source code at GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye