DSH Hub

YZz-S/dsh-token-cost-meter

dsh-token-cost-meter

UIWeb UI2 GitHub stars· updated 2026-08-15

Community plugins for DeepSeek Harness (DSH) Web GUI: session token cost meter with official dynamic pricing, DeepSeek & Volcengine billing balance, and update checker. Plain JavaScript, no build required.

Install

npx @deepseek-ai/dsh plugin --profile web add github:YZz-S/dsh-token-cost-meter

Restart `dsh web` after install. Bundle APIs can change during the developer preview.

README badge

dsh-token-cost-meter DSH Hub badge
[![DSH Hub](https://dshhub.dev/badge/dsh-token-cost-meter.svg)](https://dshhub.dev/plugins/dsh-token-cost-meter)

Paste this into your README. The star count updates with every catalog sync.

From the README

Excerpt from YZz-S/dsh-token-cost-meter, cleaned of badges and images.

dsh-token-cost-meter

English · 中文

DeepSeek Harness (DSH) plugin that shows the current session's cumulative token consumption and estimated cost (CNY) in real time in the stats line below the input box, with prices fetched dynamically from the official DeepSeek pricing page.

DeepSeek Harness(DSH)插件:在 Web GUI 输入框下方的统计行中实时显示当前会话累计 token 消耗与估算费用(人民币),价格从 DeepSeek 官方价格页动态获取。

Supports two forms: an installable dsh.bundle package (recommended, persists across DSH restarts) and the dynamic cordis_define usage (temporary run).

English

中文 · ← Back to DeepSeekHarnessPlugins

Preview

A new stats line appears below the input box (right of the built-in stats line):

Cost ¥0.13 · 43.2K tokens

Hovering shows the breakdown: pricing model, input (cache-miss / cache-hit buckets), output, pricing mode (current / peak-hour / off-peak-hour), price source and fetch time.

Features

  • Real usage: reads the session projection tokenUsage (provider-reported cumulative usage: cache-miss input / cache-hit input / output — same source as DSH's built-in stats line)
  • Official dynamic pricing: the Host fetches and parses the official DeepSeek pricing page every 6 hours (including peak/off-peak price tables, auto-switching by Beijing time)
  • Graceful degradation: if the official page fetch fails, automatically falls back to the built-in price snapshot, prefixing amounts with and noting the reason in the hover tooltip
  • Three-level model detection fallback: recent request provenancerequestConfig → Host agents.options.model; if all fail, displays a price range computed per model
  • Zero data egress: the only outbound request is the official public pricing page; token usage is displayed locally only — never uploaded or persisted

Files

FileDescription
index.jsInstalled Host half: fetches/parses the official pricing page; /api/token-cost-meter/* routes (pricing / model)
lib/client.jsInstalled Client half: UI below the input box, cost calculation
cordis.patch.ymlBundle patch: inserts this plugin's row into the DSH composition
host.jsDynamic Host half (cordis_define code.host), functionally equivalent to the installed form
client.jsDynamic Client half (code.client)
README.md / SECURITY.md / CHANGELOG.md / LICENSEDocs & license

Installation (dsh.bundle)

This repo is also an installable dsh plugin package (package.json declares dsh.bundle + dsh.client):

dsh plugin --profile web add github:YZz-S/dsh-token-cost-meter

After installation, restart DSH and the cost stats line below the input box takes effect automatically. The dynamic usage (cordis_define loading host.js / client.js) is kept; pick either one.

Usage

Method 1: dynamic Cordis plugin (temporary)

  1. Open DSH Web and enter a session;
  2. Ask the assistant to call cordis_define, submitting host.js full text as code.host and client.js full text as code.client;
  3. cordis_run the returned pluginId / packageId;
  4. Approve on the Run card (double ✓ recommended to skip approval for future updates);
  5. Refresh the page; the cost stats line appears below the input box.

A dynamic plugin lives as long as the current DSH process: after a DSH restart you must define + run it again.

Method 2: install as a regular plugin (persistent)

Related plugins