Preface

DeepSeek Harness (DSH) treats sessions, tools, and interfaces as plugins. When running a long-running Agent with the web interface open, the built-in statistics row shows how many tokens were used in this session, but to check your remaining account balance and the approximate cost of this session, you usually need to open another console or calculate it manually using unit prices.

This problem became more specific on August 17, 2026. DeepSeek officially implemented peak-valley pricing for its API starting at 0:00 Beijing Time that day. Peak hours are 09:00–12:00 and 14:00–18:00 Beijing Time, with the remaining time being off-peak hours. Flash and Pro have different unit prices, and costs also differ between cache hits, cache misses, and output tokens. It is normal for the same conversation to have a big cost difference when switching models or crossing peak hours.

dsh-balance-meter connects the official balance API and official pricing page to below the input box of the DSH web interface: a chip that shows both your total account balance and the estimated cost of the current session. This article is collated after cross-checking with the community directory details page, the repository README / README.zh.md, package.json, and the source code. The community plugin directory is an independent site and has no official affiliation with DeepSeek / Illuvatar; the positioning of DSH itself remains as stated in the official repository: everything is a plugin.

What is this

dsh-balance-meter is a session and message plugin for the DSH web interface, maintained by Ghost011118, licensed under BSD-3-Clause, with the current repository version 0.1.0. Its category is “Session and Messaging”. The GitHub repository Ghost011118/dsh-balance-meter showed 16 stars on the day of verification; the community directory page marked 13 stars at that time, so please refer to the repository page for the accurate star count.

It solves the invisible problem of “where the money went” in web sessions:
- Total account balance: Query the DeepSeek official Get User Balance API
- Estimated cost of this session: Multiply the DSH-persisted tokenUsage by the official unit price
- Pricing based on the actual model used in the session, instead of hardcoding Flash

The dsh.client.platform field in package.json is web, and the peer dependency aligns with DeepSeek Harness 0.1.0-rc.6. It is not a CLI billing tool, nor will it change your model or limit traffic; it only displays readings below the web input box.

Core Features

Balance chip below the input box

After installing and restarting the web interface, the chip will appear below the input box, on the same row as the built-in session statistics line. The example given in the repository is as follows:

余额 CNY 4.16 · 本场 CNY 2.57

Clicking the chip will expand two groups of details:
- Balance: Broken down by currency, with credit and top-up amounts shown separately
- Cost: Broken down by buckets, with input, cache read, and output tokens priced separately

Clicking the chip again when an error is displayed will immediately force a refresh. The repository notes that the error view will not be treated as fresh cache, and subsequent polling will re-query; after the network or API Key is restored, the chip will automatically return to the real-time total.

Pricing based on the actual model used in the session

The default setting is model: auto. The request header of each session records the most recently used provider/model, and the plugin maps the ID to the unit price table:
- deepseek-v4-flash → flash
- deepseek-v4-pro → pro

Therefore, a session using Pro will be priced according to Pro, instead of being hardcoded as Flash. When there is no request header yet or the model ID cannot be recognized, auto will fall back to flash. If you need to lock the estimation caliber, you can set model to flash or pro, and the automatic recognition will be ignored at this time.

The cost JSON will carry pricingKey and model, and the chip can mark which model this session is calculated based on.

Fetch unit prices from the official pricing page and identify peak/valley hours

The plugin fetches the official pricing page every 6 hours by default:
https://api-docs.deepseek.com/en/quick_start/pricing/

After fetching, it applies peak or off-peak unit prices based on the current Beijing Time. The peak hours are consistent with the official announcement: 09:00–12:00 and 14:00–18:00. There is no need to release a new plugin version when prices change.

If the pricing page fetch fails, it will fall back to the built-in preset specified in the repository (flash: 0.02 CNY per million tokens for cache hits, 1 CNY per million tokens for uncached input, 2 CNY per million tokens for output). This set of numbers is a fallback for when fetching fails, and is not the official price after the August 17 peak-valley pricing took effect. Explicit cost.* configurations in the composite configuration take precedence over any presets.

How costs are calculated

The accounting caliber is consistent with the built-in statistics row: read the DSH-persisted tokenUsage projection, and convert the four buckets into amounts:
1. Uncached input
2. Cache read
3. Cache write
4. Output

DeepSeek does not charge separately for cache writes, and the plugin defaults to 0. The balance side uses the official API; the cost side is a local estimate for checking the order of magnitude, not for billing reconciliation.

The host side will also mount the /api/balance JSON interface, and the browser side is responsible for rendering the readings on the page. The cordis.patch.yml uses a plugin line with id: balance to mount both halves.

Installation and Enablement

The environment requirements are subject to the repository README:
- DeepSeek Harness 0.1.0-rc.6 or newer (web profile)
- The DeepSeek API Key has been written via the DSH credential channel (DEEPSEEK_API_KEY, which can be filled in on the web Models page)

The installation command given on the community directory page is as follows, to be executed in the DSH terminal:

dsh plugin add github:Ghost011118/dsh-balance-meter

This plugin only works on the web interface. The maintainer’s README writes a more explicit写法 with the web profile:

dsh plugin --profile web add https://github.com/Ghost011118/dsh-balance-meter

For reproducible installations, pin the commit hash as instructed on the directory page. On the day of verification, the latest commit on master was db97c0ea49767d7e73166d8d57a13e54970533e4 (2026-08-14), with the example:

dsh plugin add github:Ghost011118/dsh-balance-meter#db97c0ea49767d7e73166d8d57a13e54970533e4

You can also install from a local checkout:

git clone https://github.com/Ghost011118/dsh-balance-meter.git
dsh plugin --profile web add link:$(pwd)/dsh-balance-meter

After installation, restart dsh web and refresh your browser. The balance chip should appear below the input box.

The plugin runs with the permissions of the current dsh process, and may execute code during installation. Please check the source code repository and license before installing.

Typical Usage

1. View readings with zero configuration

By default, it uses DEEPSEEK_API_KEY and the official pricing page, so no prior configuration is needed. After writing the Key on the web Models page:
1. Install the plugin according to the previous section
2. Restart dsh web and refresh the page
3. Start a session, and the chip should display “Balance” and “This Session”
4. Click the chip to check the credit / top-up amounts, as well as the bucketized costs for input, cache read, and output

The 余额 CNY 4.16 · 本场 CNY 2.57 in the README is just an interface example, not your actual account data.

2. Optional composite configuration

If you need to change the model preset, refresh interval, or use a compatible gateway, insert a plugin line in the composite configuration. The example given in the repository is as follows:

- insert:
    - id: balance
      name: 'dsh-balance-meter'
      config:
        model: auto         # 'auto' (default) | 'flash' | 'pro'
        pricingRefreshHours: 6

The configuration items listed in the repository:
| Key | Type | Default Value | Meaning |
|—|—|—|—|
| model | 'auto' / 'flash' / 'pro' | auto | Automatically recognize the session model, or force flash / pro |
| pricingRefreshHours | number | 6 | Refresh interval (hours) for the official pricing page |
| apiKeyEnv | string | DEEPSEEK_API_KEY | Credential reference name storing the API Key |
| baseUrl | string | https://api.deepseek.com | API base address, override when using a gateway or compatible interface |
| refreshIntervalSeconds | number | 30 | Minimum interval (seconds) between two balance queries |

In most cases, keeping model: auto is sufficient. Only change it to flash if you want to estimate all sessions using the Flash caliber.

3. How to check when the Key cannot be read

The README includes the error no API key for provider route \deepseek-official`in troubleshooting. The plugin and LLM routing use the same credential channel, and the default file is~/.dsh/.credentials.yaml` (the one written on the web Models page).

Follow the order below to verify according to the repository instructions:
1. Confirm that DEEPSEEK_API_KEY: sk-... exists in the file (the reference points to a non-empty string). You can directly modify the file while DSH is running, and the provider will hot-reload.
2. When the credential channel is mounted, the Key will only be read from this file; at this time, only exporting DEEPSEEK_API_KEY will not take effect. The export will only be used as a fallback for this plugin when the channel is not mounted.
3. It is recommended to run dsh web with a single guarded instance (such as dsh-autostart) to avoid multiple npx dsh web processes competing for the same port and reading different credential snapshots. The chip returning to the real-time total means the Key has been successfully parsed.

Applicable Scenarios and Notes

It is suitable for these situations:
- You mainly run sessions on the DSH web interface and want to see your remaining quota and this session’s cost at the same time
- You switch between Flash and Pro in the same environment and want the cost to follow the actual model used
- After the peak-valley pricing took effect, you need to estimate the session cost according to Beijing Time peak/off-peak hours
- When using a compatible gateway, you can use baseUrl to point to your own entry point

Please note the following items, all from the directory page or repository, not additional additions:
1. Only covers the web interface. package.json declares platform: web. This chip will not appear in pure terminal, desktop shell, or other profiles.
2. The this session figure is an estimate. The caliber aligns with the built-in tokenUsage and the official pricing page, and is used to check the order of magnitude; reconciliation should still be based on DeepSeek’s official billing. If the pricing page fails, it will fall back to the built-in flash preset, and the figure may be outdated.
3. The Key must be entered into the credential channel. The DEEPSEEK_API_KEY written on the web Models page is the one shared by balance queries and model routing.
4. The plugin runs with the permissions of the current dsh process. Installation may execute code. First check the GitHub source code and the BSD-3-Clause license; it is recommended to pin the commit in production environments.
5. The community directory is not an official app store. The entries come from DeepSeek Harness Plugin Library, and have no official affiliation with DeepSeek / Illuvatar. The official DSH repository is still deepseek-ai/deepseek-harness.

Summary

dsh-balance-meter adds a balance and this session cost chip below the DSH web input box: the balance uses the official API, and the cost is calculated by multiplying the same token accounting by the official unit price, and can switch according to the actual model of the session and the peak-valley hours starting from August 17. For people who often run Agents in the web interface and need to monitor their quota, it puts “how much is left and approximately how much this session costs” next to the statistics row.

Directory page and repository links:
- Community directory: https://deepseek-harness-plugin.com/en-US/plugins/dsh-balance-meter/
- GitHub: https://github.com/Ghost011118/dsh-balance-meter
- DSH official repository: https://github.com/deepseek-ai/deepseek-harness
- Official pricing page: https://api-docs.deepseek.com/en/quick_start/pricing/