Preface

When running long sessions and switching between multiple models with DeepSeek Harness (DSH), Token consumption often only reconciles with the bill afterward: how much did this session cost, what’s the daily total, did peak/off-peak pricing kick in, and how much of the Coding Plan quota remains—these figures are scattered across the official console, various subscription dashboards, and memory, making them hard to view on the same screen while coding.

The community plugin dsh-cost-meter (maintainer Han-1413141) integrates cost tracking into the DSH Web interface: session badges, sidebar balance and budget charts, history and heatmaps on the settings page, and supports official price synchronization, peak/off-peak pricing reminders, and bilingual Chinese-English support. The project has approximately 184 stars and 12 forks on GitHub, is MIT licensed, and the current release version is v1.5.45. It is categorized as a “Network Tool” in the SkillHub Plugin Library. SkillHub is a community directory for DSH plugins and has no official affiliation with DeepSeek or High-Flyer; DSH itself follows an “everything is a plugin” extension philosophy, with such tools maintained by the community, reviewed, and installed independently.

What is This

dsh-cost-meter is a web-based session cost tracking plugin for DeepSeek Harness. It wraps each LLM call within the host process, accounting in real-time based on usage and price lists, and displays in the browser the cost for the current session, daily/monthly summaries, budget progress, official and custom provider balances, as well as quota windows for OpenCode Go and various Coding Plans.

The ledger is persisted at $DSH_HOME/storages/cost-meter/ledger.json; the interface language can be set to Simplified Chinese, English, or follow the browser.

Core Features and Highlights

Session and Ledger

  • Current Session Cost: Displayed below the input area or in the session title bar, showing input/cached/output Tokens and the accumulated amount, with the position configurable in settings.
  • Daily Cost and History: A “Today ¥x” badge at the bottom of the sidebar; the settings page provides today/monthly/cumulative summaries, daily history (default retention of 180 days), and a breakdown of today’s sessions.
  • Budget Chart: Supports setting quotas and periods (today/monthly/cumulative/custom interval), with warnings at ≥80% and overspend alerts at ≥100%; alerts only, no call blocking.
  • Token Heatmap: The settings page offers a Codex-like 26-week daily usage heatmap, with hover details for daily breakdowns.
  • Pre-Installation History Import: On first startup, it can replay host session logs to backfill conversations from before the plugin was installed (idempotent, no duplication with real-time tracking).

Balance and Multi-Source Quotas

  • Official Balance: Queries api.deepseek.com for total balance/gifts/recharges, with three-stage progress bars and manual refresh; API keys reuse DSH credentials and are only sent to official domains.
  • Custom Provider Balance: Configurable for any HTTP endpoint (e.g., LiteLLM, NewApi) with JSON extraction rules to parse remaining quotas.
  • OpenCode Go Quotas: Displays rolling 5-hour/weekly/monthly usage and reset times, with keys auto-discovered or manually entered.
  • Coding Plan Quotas: Supports quota window queries for subscriptions from providers like Anthropic, Z.ai, MiniMax, Kimi, OpenRouter, SiliconFlow, CommandCode, etc.; for SCNet Token Plans without a public API, it estimates via local Credits tables.
  • Quota Bar Above Input: Budget, Go, and various Coding Plan usages are displayed as chips in a horizontal row; clicking refreshes the corresponding data source.

Pricing and Price Lists

  • Multi-Model Billing: Built-in reference price catalog for 90+ models, supporting input/output, cached, and reasoning Tokens for providers like OpenAI, Anthropic, Google Gemini, Mistral, etc.; unknown model IDs can be fuzzy-matched or manually specified.
  • Peak/Off-Peak Pricing: UTC 01:00–04:00 and 06:00–10:00 are peak hours, with off-peak pricing (approximately half of peak rates) at other times; from 2026-08-23, weekends (Beijing time Saturday/Sunday) are all off-peak, with the interface displaying “Weekend Hours—All Off-Peak Pricing”.
  • Peak/Off-Peak Switch Reminders: Full-screen color bars or browser system notifications can be sent before entering peak/off-peak periods, with configurable advance time, position, and reminder type; preview available on the settings page.
  • Official Price Synchronization: Fetches and parses the official pricing page HTML to update the price list with one click; supports USD or CNY official pages, with CNY displayed at the displayed exchange rate.

Experience Details

  • Sidebar balance/quota charts support click-to-refresh; official balance or today’s consumption can be hidden individually for screen sharing.
  • Interface and server messages support bilingual Chinese-English.

Installation and Setup

Requirements: Node.js ≥ 20, and DeepSeek Harness with the dsh plugin subcommand (e.g., npm install -g @deepseek-ai/dsh).

Install via npm package name, always following the latest registry version:

dsh plugin --profile web add dsh-cost-meter

To pin to the current release tag (e.g., v1.5.45 in the README), with pnpm and git available on your machine:

dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.45

Without git, use the direct tag archive link:

dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.45.tar.gz

After installation, restart the Web process; the plugin line and client bundle are scanned at startup:

dsh web

Uninstall:

dsh plugin --profile web remove dsh-cost-meter

The plugin runs with the current dsh process permissions and will access the network to query balances and official pricing pages. Before installation, it is recommended to review the GitHub repository source code and MIT license to ensure permission declarations (network domains like api.deepseek.com and api-docs.deepseek.com are listed in the manifest) align with your security policy.

Typical Usage Examples

Viewing Session and Daily Costs

After installing and restarting dsh web, open any session to see the current session’s accumulated cost and Token breakdown below the input area or in the title bar; the total daily cost appears at the bottom of the sidebar, with hover details for call counts. No additional configuration is needed to start tracking; prices are estimated by default using the built-in list and official peak/off-peak rules.

Setting Budgets and Synchronizing Official Prices

  1. Go to Settings → Fees, and fill in the quota and period in the “Budget” panel at the top.
  2. In the “Data & Sync” section, click Sync prices from official documentation, selecting the USD or CNY official page as needed.
  3. In “Display Settings,” enable the balance progress bar, quota bar above the input, or switch the interface language.

When the budget is overspent, the interface changes color as a reminder but does not block model requests.

Configuring Custom Provider Balance (NewApi Example)

In Settings → Fees → Custom Provider Balance, expand the configuration or edit config.customBalance in storages/cost-meter/ledger.json. The following snippet is from the official README and applies to NewApi endpoints using integer quota metrics (1 USD = 500000 quota):

{
  "enabled": true,
  "display": "both",
  "refreshMinutes": 15,
  "label": "NewApi",
  "labelEn": "NewApi",
  "unit": "USD",
  "request": {
    "url": "https://your-NewApi-domain/api/usage/token",
    "method": "GET",
    "headers": { "Authorization": "Bearer {{NEWAPI_API_KEY}}" }
  },
  "extract": {
    "remaining": { "op": "divide", "path": "data.total_available", "by": 500000 },
    "maxBudget": { "op": "divide", "path": "data.total_granted", "by": 500000 },
    "spend": { "op": "divide", "path": "data.total_used", "by": 500000 },
    "unit": "USD"
  }
}

{{NEWAPI_API_KEY}} is resolved from the DSH credential store or environment variables; after configuration is saved, it auto-persists with about 600ms debounce.

Developer Local Debugging

git clone https://github.com/Han-1413141/dsh-cost-meter.git
cd <parent-of-cloned-directory>
dsh plugin --profile web add link:./dsh-cost-meter

In symlink mode, modify lib/client.js and refresh the page to see UI changes.

Use Cases and Considerations

Who Should Use This

  • Developers running Agents, sub-agents, or multi-model routing in DSH Web who need to view Tokens and costs on the same screen.
  • Users simultaneously using the DeepSeek official API, OpenCode Go, or various Coding Plans, wanting a unified view of quota windows.
  • Scenarios where attention to DeepSeek’s peak/off-peak pricing rules is needed, with pop-up or system notification reminders before switches.

Usage Notes

  • Session badges are estimated based on current pricing tiers; exact amounts are in the ledger. If the official pricing page structure changes, synchronization may fail—manually editing the price list is a fallback.
  • Backfilling historical data by model depends on host session logs still being on disk; early calls with cleaned logs cannot be split by model.
  • If third-party quota interfaces like OpenCode Go change, errors will appear on the settings page; the corresponding module can be disabled in Display Settings.
  • Deleting $DSH_HOME/storages/cost-meter/ledger.json or using “Clear All History” on the settings page will reset the local ledger.

Conclusion

If you’re already using DeepSeek Harness but find that “how much was spent” relies on after-the-fact reconciliation, dsh-cost-meter brings session costs, budgets, balances, and multi-source quotas into a single Web UI, aligned with official peak/off-peak rules and price lists—worth installing for a trial run.