Introduction

When running sessions in DSH, cost is not just a single item like “model output”. Tool inputs, tool outputs, system prompts, terminal commands, attachments, system reminders, and user inputs all enter the request. It is difficult to judge which category of content contributes the most cost when only seeing the total spending.

Below is an introduction to dsh-bill. It breaks down the cost in DSH sessions into different content types and displays relevant status in every round of conversation, the sidebar, the report page, and the budget.

What is it

dsh-bill is a DSH cost attribution and usage dashboard plugin, maintained by Jannchie, licensed under MIT. It is based on llm-pricing for price parsing, with a dependency version of ^0.17.0.

It mainly solves three categories of problems:

  • How much each completed round costs, along with step count and cache hit status.
  • What specific types of content make up the total cost.
  • Budgets, balances, monthly forecasts, and multi-currency display.

Core Features

Cost Attribution

dsh-bill breaks down the bill by content type, including:

  • tool output
  • model output
  • system prompt
  • terminal commands
  • tool input
  • attachments
  • system reminders
  • user input

The report page also shows breakdown details, trend charts, and heatmaps.

Cost per Round

Below each completed round, a line of information is displayed, including:

  • Current round cost
  • Step count
  • Cache hit rate

This line comes directly from the session logs, so historical rounds before installation can also be backfilled as costs.

Persistent Status

dsh-bill keeps status permanently on the interface:

  • Displays a line of cost information below existing statistics rows.
  • Shows the position of today’s spending relative to the budget in the sidebar.

Visible surfaces can be adjusted in settings.

Report

The Cost tab in a session will display:

  • total
  • tokens
  • cache hit
  • peak share
  • monthly forecast
  • account balance

It also provides breakdowns by model, session, and use case, as well as trend and heatmap views.

Budget

You can set:

  • Daily budget
  • Monthly budget
  • Full-cycle budget

The color changes when the budget usage exceeds 80%, and it also changes when over budget.

Multi-currency

dsh-bill provides real-time exchange rates for approximately 166 currencies. The base rates for each model are displayed in the currency used by the pricing provider.

Agent Tools

The plugin provides a bill_stats tool, allowing models to directly answer questions about spending based on it.

Installation and Activation

First, install it to the web profile:

dsh plugin --profile web add dsh-bill

After installation, restart dsh web to enable the plugin.

Typical Usage

Setting Budget, Currency, and Visible Surfaces

Open the Cost page in settings to set budget, currency, and visible surfaces. Preferences are written to:

$DSH_HOME/dsh-bill/prefs.json

After the steps above, the sidebar and statistics rows will display according to your settings.

Viewing Cost per Round and Reports

In a conversation, below each completed round, the current round’s cost, step count, and cache hit rate are displayed.

Open the Cost tab in a session to view the total, tokens, cache hits, peak share, monthly forecast, account balance, as well as breakdowns and trend views.

Letting the Model Query Spending

When you need the model to directly answer questions related to spending, you can use the bill_stats tool provided by the plugin.

Price Overrides

If you need to override a price, you can edit:

~/.dsh/profiles/web/cordis.patch.yml

Configure price overrides in priceOverrides. priceOverrides are validated at startup.

The plugin also exposes a maxRecords configuration item with a default value of 20000.

Use Cases and Notes

Suitable for the following scenarios:

  • You want to see where the money in DSH sessions is actually spent on specific types of content.
  • You need cost per round, step count, and cache hit rate.
  • You need budgets, balances, monthly forecasts, and multi-currency display.
  • You want the model to query spending directly via bill_stats.

Pay attention to the following points before use:

  • package.json’s engines requires node >=20.
  • Dependencies include llm-pricing ^0.17.0.
  • Peer dependencies include @deepseek-ai/dsh-atomic-write and @deepseek-ai/dsh-tools.
  • Client platform is web, and @deepseek-ai/dsh-client-ui-conversation is injected.
  • Call records are written to:
$DSH_HOME/dsh-bill/records.jsonl

Records use a ring buffer of 20000 entries, and old records are rolled up.

  • The account balance API key is used on the host side and does not reach the browser.
  • Network requests are limited to the price directory, exchange rate endpoints, and balance queries; session content is not stored.
  • Unmatched model names are marked as ? and excluded from the total; estimates are not made.
  • Historical data before installation can be backfilled as costs from session logs, but attribution cannot be traced; the report will explain the coverage ratio.
  • The plugin runs with the permissions of the current dsh process. It is recommended to check the source code and license before installation.

Conclusion

The value of dsh-bill lies in breaking down the spending in DSH sessions into content types, rounds, budgets, and balances, rather than just providing a total.

Directory Page: The dsh-bill entry in the DSH Community Directory. The Community Directory is an independent site, not the DeepSeek or Huanfang official app store.

GitHub:

https://github.com/Jannchie/dsh-bill