返回目录
模型与 MCP 插件

dsh-deepseek-cny-cost

zhiciyishuyicheng-dev/dsh-deepseek-cny-cost

DeepSeek Harness plugin: a live CNY cost estimate for the chat you are reading, priced with DeepSeek's peak / off-peak rates.

Stars
1
Forks
0
Issues
0
更新
6 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:zhiciyishuyicheng-dev/dsh-deepseek-cny-cost

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-deepseek-cny-cost

See what the chat you are reading has cost today, in CNY, inside the DeepSeek Harness Web GUI.

A small badge sits under the composer next to the session statistics:

今日 ≈¥0.0123
  • The number is today's spend (Beijing time, since 00:00) in the chat you are looking at; it grows as the chat works, and every day at midnight it resets to zero and starts counting again;
  • Switching chats switches the number — each chat has its own daily counter;
  • Hovering (or a screen reader) reveals the breakdown: today's uncached input, cache-hit input and output tokens, each with its own cost, plus the chat's lifetime total;
  • It renders only while the selected provider is a DeepSeek official route, because third-party relays are not billed at DeepSeek's peak / off-peak rates.

How it prices

It reads two projections the session already exposes and issues no requests of its own:

Data Source
Token usage tokenUsage (uncachedInputTokens, cacheReadTokens, cacheWriteTokens, outputTokens)
Current model modelSelection

Prices come from the official Models & Pricing page (checked 2026-10), in CNY per million tokens:

Model Cache hit Cache miss Output
deepseek-flash 0.04 2 8
deepseek-v4-pro 0.30 9 27

Those are peak rates. Off-peak is half of peak; peak is Beijing time Monday–Friday (excluding Chinese statutory holidays) 09:00–12:00 and 14:00–18:00, and every other hour — weekends and holidays included — is off-peak.

  • Cache writes are billed at the cache-miss input rate, matching DeepSeek's rule that there is no separate write fee;
  • Legacy names deepseek-v4-flash and deepseek-v4-flash-vision-exp are priced as Flash, per the official note;
  • An unknown model name hides the badge instead of inventing a price.

The daily reset

tokenUsage is a whole-chat total with no timestamps and no per-day split, so "today" is derived from a daily baseline:

spent today = cumulative usage − today's baseline

The baseline is stored per session id in the browser's localStorage (key dsh-deepseek-cny-cost.day.v1), so switching chats, refreshing the page, or restarting DSH keeps the part of today that is already spent. Once Beijing midnight passes, the baseline is replaced and the badge drops to zero.

  • Page open at midnight: the reset lands within one refresh period (30 s);
  • Page closed around midnight: tokens only grow while the page is running, so yesterday's last observed total is used as today's baseline — close DSH overnight, reopen it in the morning, and the morning's spend still counts for today;
  • Storage wiped (browser data cleared, private mode) or the session untouched for more than a day: there is no way to tell which day the old money belongs to, so counting restarts from the current total. That is deliberate: it is better to drop one unaccountable stretch than to bill old days to today.

Known limits

  • An estimate, not an invoice. It excludes per-request Search / Fetch charges; the official bill wins.
  • One rate for the whole day. Today's tokens are priced at the peak / off-peak rate in effect right now, so a day that crosses a peak boundary (used at 11:00, checked at 15:00) is off by that difference.
  • Chats that switched models are priced with the currently selected model, because tokenUsage is a whole-chat total with no per-model split.
  • Holidays: the built-in table covers 2026. A year without an entry falls back to weekends only, so its holiday weekdays would be priced as peak.
  • Shown for DeepSeek official providers (deepseek-official, deepseek-account, or any new provider id starting with deepseek).

Install

Desktop: Plugins → Add plugin, enter the absolute path of this directory (the installer records a link: dependency), then install and enable. Restart DSH completely if it asks, then refresh the page.

Command line, for a non-desktop profile:

dsh plugin --profile web add /absolute/path/to/dsh-deepseek-cny-cost

Customize

Everything lives at the top of client.js:

  • PEAK_PRICES — the rate table (peak rates; off-peak is half);
  • MODEL_ALIASES — legacy model-name folding;
  • PEAK_WINDOWS — peak ranges in minutes of the day;
  • BUILTIN_HOLIDAYS — the offline holiday fallback;
  • TICK_MS — refresh period, 30 s by default (also how late the midnight reset can be);
  • STORE_KEY / WRITE_THROTTLE_MS — the baseline store key and its write throttle;
  • Slot and order — change name / order in apply() (defaults: conversation.input.right, order: 1).

Develop

node --check client.js
node tools/test-cny-cost.mjs   # pricing, peak windows, daily reset, formatting, slot registration, component behavior

client.js is the whole browser half: a lazy factory registered through window.__ModuleLoader__.load({ id, factory }), with React supplied by the host module table. Refresh the page to pick up an edit; if the page keeps running the old code, remove the bundle and install it again from the same source (ambiguous-install otherwise).

License

MIT.

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类模型与 MCP
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。