Introduction¶
When running conversations with tool calls in DSH, the model might continuously perform operations such as reading files, running commands, or calling MCPs within a single turn. The Provider side typically only provides usage for the entire turn without breaking it down by tool. Furthermore, with cache hits, “how much entered the context” and “how much is billed” are not necessarily the same thing. To troubleshoot why the context length increased in a specific turn, or to compare which tools “occupy more space,” you need per-tool attribution after the turn ends, rather than just the billing amount.
Below is an introduction to the community plugin dsh-tool-cost-hint (maintainer: qiyuexue-xiyu, Category: Model Inference). It does not report monetary costs; instead, it calculates the approximate number of tokens injected into the model-visible context for each tool during the current turn and provides a collapsible summary line at the bottom of the conversation stream.
What is this¶
dsh-tool-cost-hint is a purely passive, observational DSH bundle: it does not register tools, write content to the model context, or append any session events. It listens to session/event and, at every turn/end, organizes information on “which tools were called this turn, how many times, and how many tokens each injected.”
The current implementation covers two aspects:
- Host side: Records metrics in-process, collapses the summary, and emits it externally.
- Client side: Inserts a collapsible hint line at
conversation.chat.turnTailto render the existing collapsed results in the browser.
The attribution criteria are consistent with the README: it displays “Injected Volume” (inputTokens + outputTokens) without price conversion; total turn billing can be delegated to plugins like dsh-bill, with no overlap between the two.
Repository and Directory Pages:
- GitHub: https://github.com/qiyuexue-xiyu/dsh-tool-cost-hint
- SkillHub Directory: https://www.skillhub.cn/plugins/qiyuexue-xiyu/dsh-tool-cost-hint
The current Release version is 0.2.0 (MIT, Node >=20). The package has not been published to the npm registry, so installation should use the pre-built tarball (containing dist/) from the Release.
Core Features¶
Passive Listening and End-of-Turn Summary¶
The plugin creates an accumulator for the current turn at turn/start; accumulates call counts and call-side tokens (tool name + argument JSON, estimated using the framework’s estimate formula) at tool/call; pairs callId and records result-side tokens (preferring meter, otherwise estimate) at tool/result; and calls ctx.tokenMeter.measure() once at turn/end to override applicable estimates with official measurements before collapsing them into a summary.
Unpaired situations are explicitly recorded—for example, unattributedCalls (when a tool/call was sent but no tool/result followed) or orphanResults (caused by mid-session loading)—to avoid silent data loss.
Meaning of Injection Fields¶
| Field | Meaning |
|---|---|
inputTokens |
Tool call-side injection: Tokens of the tool-call blocks in this turn’s tool/call (mostly estimates, as tool/call is not a surface event) |
outputTokens |
Tool result-side injection: Tokens of the tool/result entering the model-visible surface |
injectedTokens |
The sum of the two; this is the “Injection Volume” shown in the UI |
The README emphasizes: After a cache hit, “injecting 3000 tokens” does not equal “paying for 3000 tokens,” so the plugin does not display amounts.
Conversation UI Hint¶
Once installed, a clickable, expandable summary line will appear at the bottom of replies that used tools in that turn, above the action bar, in a form similar to:
🛠 read ×1 · pwsh ×2 · ≈3.4K tok
Upon expanding, you can see line-by-line “Tool Name / Count / Input / Output,” with the total injected volume on the last line. If this line does not appear, it usually indicates the plugin was not loaded correctly, and you should troubleshoot using the installation steps.
Installation and Activation¶
The plugin runs with the current DSH process permissions; before installing, it is recommended to read the repository source code and MIT license, and obtain the tarball from the official Release or trusted channels. The SHA256 for v0.2.0 (for Windows certutil verification) is: 73190410b86206af6e4b5785dec006f2ca59a7c6ce8c97b637607285fb19cba6.
Command Line Profile (Recommended Tarball)¶
Fixed download link (always points to the latest Release pre-built package):
https://github.com/qiyuexue-xiyu/dsh-tool-cost-hint/releases/latest/download/dsh-tool-cost-hint-0.2.0.tgz
After downloading locally, execute the following for non-desktop versions (such as profiles used by dsh web / dsh tui):
dsh plugin --profile web add ./dsh-tool-cost-hint-0.2.0.tgz
You can also use the GitHub source (requires local access to GitHub and the build chain, as dist/ is not included in git):
dsh plugin --profile web add github:qiyuexue-xiyu/dsh-tool-cost-hint
Note: Repository webpage URLs cannot be used directly as installation sources. For example, the following form is invalid:
dsh plugin add https://github.com/qiyuexue-xiyu/dsh-tool-cost-hint
DSH Desktop (Electron)¶
The desktop profile in the desktop version is exclusively owned by the Electron main process. dsh plugin --profile desktop add ... will error out, which is by design. Manual configuration changes are required.
- Install the local tgz using npm or pnpm under
%USERPROFILE%\.dsh\profiles\desktop\, for example:
npm install "C:\Users\you\Downloads\dsh-tool-cost-hint-0.2.0.tgz"
-
Edit
%USERPROFILE%\.dsh\profiles\desktop\package.json: Add thefile:path fordsh-tool-cost-hinttodependencies, and append"dsh-tool-cost-hint"to the end of thedsh.profile.bundlesarray (modifying dependencies alone will not load the bundle). -
Completely exit the DSH process and reopen it (quit from the system tray or end the process; closing the window is not enough).
Upon successful installation, node_modules\dsh-tool-cost-hint\dist\index.js should exist. The loader will apply the package’s cordis.patch.yml to insert tool-cost-hint into the composition.
Typical Usage¶
After installation and restart, send a message that triggers tool calls (e.g., ask the assistant to read a specific file). After the turn ends, check if the tool cost collapsible line appears at the bottom of the reply; click to expand and verify the counts and injected volume for each tool.
If you need to distribute the package to others, the README recommends sending the Release download link mentioned above directly; the recipient can use the same dsh plugin --profile web add ./dsh-tool-cost-hint-0.2.0.tgz command in the command-line version. For the desktop version, the recipient must manually modify package.json following the “Pre-installation Reading” section.
Use Cases and Precautions¶
Suitable for:
- Debugging long contexts: Quickly view which tools were used in a turn and how many tokens each injected.
- Comparing tool output size: e.g., whether shell commands or file reads occupy more surface space.
- Division of labor with billing plugins: This plugin only manages “how much was stuffed in,” not “how much money was spent.”
Precautions:
inputTokensis mostly an estimate for the tool/call side; the data structure usesinputTokensSource/outputTokensSourceto indicate the source.- The plugin does not cache tool/result bodies, only recording seq and token numbers to avoid large memory retention of result blocks in long sessions.
- The DSH ecosystem is “everything is a plugin”; directories like SkillHub and DSH Plugin Hub are community sites and have no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-tool-cost-hint uses passive accounting once per turn to break down tool calls from “black-box usage” into a readable summary of injected volume, placing it at the end of the Web conversation. If you need monetary amounts, simply install a separate billing plugin.
- Directory Page: https://www.skillhub.cn/plugins/qiyuexue-xiyu/dsh-tool-cost-hint
- Source Code & Docs: https://github.com/qiyuexue-xiyu/dsh-tool-cost-hint
- Current Release: https://github.com/qiyuexue-xiyu/dsh-tool-cost-hint/releases/tag/v0.2.0