Preface

When running long-context tasks with DSH, cache hit rates are often impressive, but total spending doesn’t stop there: the longer the context, the more cached tokens carried in each request, and the bill keeps growing. “Cache hit rate 100% but getting more expensive” describes exactly this situation. Knowing token usage isn’t enough; you need to know how much these tokens cost in money to judge when to start a new session or compress the context.

Below is the introduction to meow-cachebilling (Meow Bill), a DSH web plugin that puts real-time billing into the popup layer of the context ring.

What is it?

meow-cachebilling is a DSH plugin maintained by Phant0Meow, licensed under the MIT license. It renders a borderless small billing table at the bottom of the popup to the right of the input box’s context ring: one step, one round, and session rows, with a column for the total price in each row. The three columns on the right display cache hits, cache misses, and output details. The bill and “how much context was used” are displayed side-by-side, allowing token usage and costs to be checked together.

Core Features

Three-Level Billing in One Table

Each current API request (one step), current round, and session cumulative totals are merged into one borderless small table. The first column contains row labels (“One Step / One Round / Session”), followed by an independent column for the total price. The three columns on the right are cache hits, cache misses, and output details, providing a comparison at a glance.

Automatic Peak/Valley Pricing Determination

Peak pricing applies during Beijing Time weekdays 09:00–12:00 / 14:00–18:00; Valley pricing applies during all other periods and weekends. The determination is a pure event moment conversion, independent of the system timezone. Peak/Valley labels are written in the model info row: DeepSeek official routes are marked “Peak/Valley,” other routes write “Peak Price/Valley Price,” and fixed-price items are not marked.

Third-Party Relays Also Supported

Official routes are priced precisely according to list prices. Third-party relays simply report usage in the response and are still recorded: if the model name matches the price list, it is billed at list price (peak/valley or fixed); if it doesn’t match, it is estimated at the flash rate and marked in the bill. Note that third-party rates are local estimates; actual deduction is based on your bill.

Visual Editing of Price List

A dedicated “Meow Cache Billing” tab has been added to the settings page (parallel with “General” and “Models”). You can add, modify, or restore presets. Changes take effect immediately without a restart. The rates.yml in the package root is the preset layer; modifying it requires restarting dsh web. Badly written entries will be automatically skipped with a warning and won’t break DSH.

Model-Based Pricing

V4 Flash / V4 Pro / V4 Flash Vision Exp have different unit prices, calculated based on the actual model used per step.

Two Step Counts

Session cumulative totals add up item by item based on the peak/valley rate of each event moment, without comparing across rounds. There are two step counts: “Cache Invalidation Count” refers to the step where the API returned a cache write token (a write means a prefix change, invalidating the old cache); “Total Invalidation Count” refers to a step that has input but a cache hit of 0. The official API does not report cache write tokens, so “Cache Invalidation Count” can only be calculated by partial relays. In a brand new session, the first round has no cache to hit, so the amount will be truthfully displayed and counted into the “Total Invalidation Count” — this is a normal phenomenon.

Adaptive Amount Precision

Amounts less than 0.01 are rounded to one decimal place; 0.005, 0.0003, and other such fractions are immediately visible. Amounts greater than or equal to 0.01 are rounded to cents.

Average Cumulative Spending Curve

The plugin stores the real spending for every step of each session. It aggregates the average cumulative spending curve of sessions from the last 30 days by “Provider/Model/Peak/Valley” and draws the actual cumulative spending of the current session on the same graph. By comparing the curve slope, you can intuitively see the difference between this session’s spending growth rate and the historical average.

Two Data Sections in the Right Column

The curve graph is compressed on the left half, and the right half contains two data sections: “Consumption Comparison” includes Read (Tokens), Cache, and Cache Invalidation; “Cache” includes Total Invalidation Count, estimated cache time, and probability of current invalidation (the latter is a placeholder to be implemented). On desktop, hovering over the tags provides explanations; on touch devices, they are displayed as well, just without the hover explanation.

Installation and Enabling

Install command:

dsh plugin --profile web add github:Phant0Meow/dsh-meow-cachebilling

Installation takes effect automatically: it compiles during installation (the package includes a prepare script), mounts automatically, and is enabled after restarting dsh web. No configuration is needed.

Known Pitfall: pnpm ≥ 10 blocks build scripts during installation by default. The first add may fail with a prompt about allowBuilds. Follow the prompt to add the output key to the profile’s pnpm-workspace.yaml and rerun.

Uninstall command:

dsh plugin --profile web remove meow-cachebilling

It will no longer load after restarting dsh web.

Typical Usage

  1. View Bill: Open the context ring to the right of the input box; the bottom of the popup is the bill.

  2. Customize Price List: First, add, modify, or restore presets in the “Meow Cache Billing” tab on the settings page; changes take effect immediately. To modify the preset layer, edit the package root rates.yml. For peak/valley items, use the cross multiplication of days × ranges; for fixed prices, use const; for timezones, use the IANA name. After changing, restart dsh web.

The built-in price list is the official list price as of 2026-08-17 (¥ / Million tokens):

Model Peak (Hit / Miss / Output) Valley (Hit / Miss / Output)
deepseek-v4-flash 0.1 / 3 / 9 0.05 / 1.5 / 4.5
deepseek-v4-pro 0.3 / 9 / 27 0.15 / 4.5 / 13.5

Data Scope and Explanation

  • Accounts only recognize the four types of tokens in usage: input / cacheRead / cacheWrite / output.
  • The history of spending for each step is stored in the DSH official storage layer (meow_cachebilling.json). The curve becomes more accurate as sessions accumulate; old sessions are refilled based on the current price list when they become active again.
  • The three-level billing and cache invalidation statistics come from a major rewrite of better-er (PR #2), and the display support for non-DeepSeek official APIs also comes from their changes.
  • If you plan to fork and modify the code, note that the factory in lib/client.js must end with return module.exports; otherwise, the module exports as undefined, causing DSH to fail loudly on startup.

Applicable Scenarios and Notes

Suitable for the following types of users:

  1. Users who run long-context, multi-round tasks frequently and want to know the actual money spent per step, round, or entire session.
  2. Users who use third-party relays and want a local accounting reference.
  3. Users who care about the peak/valley price difference and want to reconcile item-by-item based on event-time rates.

Note: The plugin runs with the permissions of the current DSH process. It is recommended to check the source code and license before installing (this project is MIT). rates.yml is the preset layer and updates with the version; your modifications in the settings page are an independent layer and take effect immediately.

Conclusion

meow-cachebilling translates “cache hit rate” into “how much money this step actually cost.” The bill lives in the context ring popup, allowing you to check context usage and reconcile costs at the same time. DSH’s philosophy is that everything is a plugin, and billing capabilities are filled by community plugins as well.

  • Plugin Directory Page: https://www.skillhub.cn/plugins/Phant0Meow/dsh-meow-cachebilling (Community independent directory, no official affiliation with DeepSeek / High-Flyer)
  • GitHub Repository: https://github.com/Phant0Meow/dsh-meow-cachebilling