Zenjibad/deepseek-cost-usage-status-plugin
DeepSeek Harness(DSH)Web界面的实时DeepSeek API成本、使用量及余额状态行。打包的DSH插件——包含高峰/非高峰(北京时间)、会话成本、消耗速率、账户余额。
Project Overview项目介绍
A packaged DSH plugin that adds a second, font-matched status line under the native conversation stats, showing live DeepSeek API session cost, burn rate, account balance, current model, and reasoning effort. Cost is priced from DeepSeek's official CNY table with the 50% off-peak discount, then converted to the account's currency for direct comparison with balance. Install once via the DSH CLI and restart. Caveat: the API key travels as a curl header visible to other local processes, and balance shows a placeholder when the key is missing.
DSH 打包插件,在原生统计行下方新增一条彩色状态行,实时显示 DeepSeek API 的会话费用、消耗速率、账户余额、当前模型及推理档位。费用按官方 CNY 价目表(含 50% 闲时折扣)计算,再依账户币种换算并与余额同单位展示。适合希望边用边盯用量与成本、控制预算的 DSH 用户。安装仅需一条 CLI,重启后每 2 秒刷新一次。注意:API key 通过 curl 头传递,本机其他进程可见;无 key 时余额显示占位符。
请帮我了解并安装插件:【deepseek-cost-usage-status-plugin】【https://github.com/Zenjibad/deepseek-cost-usage-status-plugin】
Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add deepseek-cost-usage-status-plugin
把 Zenjibad/deepseek-cost-usage-status-plugin 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
DeepSeek Cost / Usage / Status Plugin for DeepSeek Harness
A packaged Cordis plugin for DeepSeek Harness (DSH) that adds a second, colored status line under the shipped conversation stats line, showing live DeepSeek API cost, usage, and account balance.
● Off-peak 00:47 · −50% · Cost ¥0.0412 · ~¥1.23/min · Balance ¥12.42 · Model deepseek-v4-flash ← CNY account
● Off-peak 00:47 · −50% · Cost $0.0057 · ~$0.17/min · Balance $1.73 · Model deepseek-v4-flash ← USD account (cost auto-converted from CNY)
Features
- On / off-peak indicator — green when off-peak (idle), red when peak, using DeepSeek's official Beijing-time peak windows (09:00–12:00, 14:00–18:00). The clock shows your local timezone; the decision is Beijing-time so the color matches what DeepSeek actually bills.
- Session cost — real per-session token usage accumulated from the
llm/streamwaterfall, priced with official CNY rates including the 50% off-peak discount, then converted into your account's currency (from the balance API) so cost and balance are directly comparable. - Burn rate —
~/minin the same display currency, i.e. session cost ÷ elapsed minutes since the session's first model call. - Account balance — polled from DeepSeek's
/user/balanceevery 60s using DSH's ownDEEPSEEK_API_KEY; degrades toBalance —if the key is unavailable/network fails. - Current model + reasoning effort.
- Font-matched to the shipped stats line (12px/20px, muted tertiary color, centered) so it reads as the same family.
Quick start
This is a packaged profile plugin — install once with the official CLI, it loads on every DSH boot and survives restarts (no cordis_define):
dsh plugin --profile web add deepseek-cost-usage-status-plugin
# or from a local checkout:
dsh plugin --profile web add ./deepseek-cost-usage-status-plugin
Then restart DSH. The plugin renders its line in the conversation.composer.dock slot (a new cell beside the shipped stats cell), fed by GET /deepseek-cost/api.
Requirements
- DSH 0.1.0-rc.6+ with the web UI and a configured DeepSeek provider.
- A DeepSeek API key stored as
DEEPSEEK_API_KEYin~/.dsh/.credentials.yaml(reused for the balance read). Without it, balance shows—; the rest still works.
How it works
- Host half (source of truth): wraps the
llm/streamwaterfall, forwards every chunk untouched, reads the terminalusagechunk per completed call, accumulates per-session token/model/timing, computes cost from thePRICINGtable (official CNY, peak-class; idle = 50%) with the Beijing-time peak decision, and polls balance viacurl.exe+subprocess. Serves the snapshot overGET /deepseek-cost/api(awebServerroute — the packaged-plugin replacement for the dynamicharness.handleRPC seam). - Client half: registers in
conversation.composer.dock, polls/deepseek-cost/apievery 2s, and renders the font-matched line with a green/red peak chip.
User-currency cost display
Cost and burn rate are computed in CNY (the pricing table's basis) and then displayed in your account's currency — the one returned by GET /user/balance (usually USD). That way Cost and Balance share the same unit. The conversion uses a hybrid FX rate:
- Live — fetched from open.er-api.com (
/v6/latest/CNY, free, no key) through the samecurl.exe+subprocesspath as the balance poll, refreshed hourly by default (fxRefreshMs). - Fallback — a configured fixed rate (
fallbackFxRate, CNY per 1 unit of the display currency, e.g.7.2for USD), used only when the live fetch fails.
If neither a live rate nor a fallback is available — or the balance is unknown (no API key / network failure) — cost simply stays in CNY. No wrong numbers are ever shown.
Configuration
Set from a patch layer, e.g. $DSH_HOME/cordis.patch.yml:
deepseek-cost-usage-status-plugin:
config:
fallbackFxRate: 7.2 # CNY per 1 USD — used when the live FX fetch fails
fxRefreshMs: 3600000 # live FX refresh interval (default 1 h)
| option | default | meaning |
|---|---|---|
fallbackFxRate |
unset | Fixed CNY→display-currency rate used when the live FX fetch fails |
fxRefreshMs |
3600000 |
How often to refresh the live FX rate (min 60 000) |
The currency symbol follows the account currency (¥, $, €, £, …); unmapped ISO codes render as their 3-letter code.
Pricing table (official DeepSeek CNY, per 1M tokens, effective 2026-08-17)
| model | cache-hit in | cache-miss in | output | |
|---|---|---|---|---|
| deepseek-v4-flash | idle | ¥0.05 | ¥1.5 | ¥4.5 |
| peak | ¥0.10 | ¥3.0 | ¥9.0 | |
| deepseek-v4-pro | idle | ¥0.15 | ¥4.5 | ¥13.5 |
| peak | ¥0.30 | ¥9.0 | ¥27.0 |
Update PRICING in src/index.ts (single place) when rates change.
FAQ
- The line shows
Cost …/Balance —? The host route is unreachable, the balance key is missing (~/.dsh/.credentials.yaml→DEEPSEEK_API_KEY), or the balance call failed (network / non-200). Cost/peak still work without balance; the line self-recovers on the next poll. - Why does the balance read put the API key on a curl command line? The key travels as an
Authorizationheader argument tocurl.exe(visible to other processes on this machine) — an accepted tradeoff for this readout tool. No key is stored or logged by the plugin itself. - Why is cost shown in my account's currency? The plugin converts the CNY price into the currency your balance API returns (usually USD), so cost and balance are comparable. The rate is fetched live (hourly) and falls back to your configured
fallbackFxRatewhen the fetch fails; without any rate, cost stays in CNY.
Layout
src/index.ts— the host half (waterfall wrap, pricing, balance poll,/deepseek-cost/apiroute).src/client/index.tsx— the client bundle (2s poller, dock line).cordis.patch.yml—dsh.bundle.patch: mounts the plugin row at boot.tsdown.config.ts— builds host (node ESM) + client (CJS ModuleLoader closure).tests/fixtures/balance.json— real-shape/user/balanceresponse sample.AGENTS.md— guide for AI agents / maintainers.README.zh.md— 中文文档.
License
MIT — see LICENSE.
wssfk12138/dsh-damage-pulse
songoao25/dsh-bottom-info-bar
Rianico/dsh-better-edit
Phant0Meow/dsh-meow-cachebilling
Ghost011118/dsh-balance-meter
ai-shushu/dsh-quota-meter
TwotwoPiggy/dsh-balance
GooodWei/context-vista