rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
doublemolu/dsh-costometer
花知多少 · Cost-O-Meter — DeepSeek Harness cost & balance meter: account balance, recharge history, per-conversation spend & tokens, 50-yuan segmented progress bar, low-balance guard, 8 languages & currencies with auto FX rates (CNY base).
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:doublemolu/dsh-costometer
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A permanent DeepSeek Harness (DSH) cost & balance meter: account balance, recharge history, per-conversation spend and token usage, a segmented 50-yuan progress bar, and a recharge shortcut — all in a card docked above the Settings button in the left sidebar.
Works with both the wide sidebar (full card) and the collapsed 56px rail (status dot).
dsh-costometer = dsh (DeepSeek Harness) + cost + -ometer (a measuring instrument) — a "money-spend meter". Its Chinese title is 花知多少 (huā zhī duōshǎo), a playful take on "how much have you actually spent?" — the plugin answers that question at a glance: balance, every conversation's cost, recharge history, and a low-balance guard.
GET /user/balance endpoint — no tokens consumed.本次用量 (latest single model call): tokens + estimated cost of the most recent call.本会话累计 (conversation total): folded from the durable session log, so it survives DSH restarts. Cost is estimated per call using the actual model and DeepSeek's official CNY peak/off-peak pricing.本会话累计调用模型次数: how many times the model was called in this conversation.最近充值 (last top-up time + amount) and 累计充值 (total topped up), tracked locally by observing balance growth (the official API exposes no recharge history).DEEPSEEK_API_KEY) — normally set from Settings → Models. The plugin reuses the same credential the chat model uses.# in your dsh profile directory (~/.dsh/profiles/web)
dsh plugin --profile web add git+https://github.com/doublemolu/dsh-costometer.git
git clone https://github.com/doublemolu/dsh-costometer.git
cd ~/.dsh/profiles/web
pnpm add file:/absolute/path/to/dsh-costometer
Add the row to your profile composition ~/.dsh/profiles/web/cordis.patch.yml:
- insert:
- id: balance-dock
name: dsh-costometer
Plugin-set changes take effect on restart. After restart the card appears above the Settings button automatically — it is a permanent plugin and survives restarts (no manual re-run needed).
| Sidebar state | What you see |
|---|---|
| Wide sidebar | Full card: balance, granted/topped-up split, latest call usage, conversation total, model-call count, segmented progress bar, recharge button |
| Collapsed rail (56px) | Small status dot (green / amber / red) with a tooltip summary |
剩余 ¥xx / 充值 ¥xx; hover 本会话累计 to see per-model breakdown.▼/▲ ¥xx indicator next to the balance shows recent changes; the card footer shows the last refresh time.All tunables live in $DSH_HOME/dsh-costometer.json (auto-generated with defaults on first run). Edit and save — the plugin picks changes up within ~10s.
{
"segmentBase": 50,
"redThreshold": 15,
"warnLow": 10,
"warnDanger": 3,
"fxCny": 7.1,
"lang": "zh-CN",
"currency": "CNY",
"prices": {
"deepseek-v4-flash": { "peak": { "in": 3.0, "inHit": 0.10, "out": 9.0 }, "off": { "in": 1.5, "inHit": 0.05, "out": 4.5 } },
"deepseek-v4": { "peak": { "in": 3.0, "inHit": 0.10, "out": 9.0 }, "off": { "in": 1.5, "inHit": 0.05, "out": 4.5 } },
"deepseek-chat": { "peak": { "in": 2.0, "inHit": 0.20, "out": 3.0 }, "off": { "in": 1.0, "inHit": 0.10, "out": 1.5 } },
"deepseek-reasoner": { "peak": { "in": 4.0, "inHit": 1.0, "out": 16.0 }, "off": { "in": 2.0, "inHit": 0.5, "out": 8.0 } }
}
}
| Key | Meaning | Default |
|---|---|---|
segmentBase |
Progress-bar segment amount (yuan) | 50 |
redThreshold |
Rightmost segment turns red below this (yuan) | 15 |
warnLow / warnDanger |
Low-balance alert thresholds (yuan) | 10 / 3 |
fxCny |
Only used for the secondary approximate USD figure of cost estimates (estUsd); costs themselves are priced directly in CNY | 7.1 |
lang |
UI language: zh-CN / zh-TW / en-US / en-GB / de / ja / ko / ru |
zh-CN |
currency |
Display currency: CNY / TWD / USD / GBP / EUR / JPY / KRW / RUB (auto-updated rates against CNY) |
CNY |
rates |
Built-in fallback exchange rates (1 CNY → currency); live rates auto-fetch from a free API (multi-endpoint fallback), 6h cache, zero token cost | built-in |
prices |
Official CNY peak/off-peak pricing per model, per million tokens (peak / off sets) |
official |
lib/index.js) registers same-origin HTTP routes on the DSH web server:GET /dsh-balance/balance — resolves the DEEPSEEK_API_KEY credential and calls the official balance endpoint with Node's native fetch (no child process).GET /dsh-balance/spend — live usage from an llm/stream interceptor + a durable fold of assistant/message events from the session log (per-call model, official pricing, peak/off-peak discount).GET /dsh-balance/config — client-facing tunables.GET /dsh-balance/guard-ask — position-guard popup via the user-questions service.client.js) is a classic-script bundle registered through window.__ModuleLoader__.load, rendering the card in the sidebar.footer.action slot and polling the routes with the browser's native fetch.deepseek-v4-flash / deepseek-v4 / deepseek-chat / deepseek-reasoner; unknown models fall back to deepseek-chat).fxCny is not the pricing currency — it only produces the secondary approximate USD figure (estUsd). Adjust the prices section in the config file to tune the estimate.Your DeepSeek API key is never stored, committed, or transmitted by this plugin:
DEEPSEEK_API_KEY. No .credentials.yaml, .env, or any secret file is committed.credentials.resolve('DEEPSEEK_API_KEY')) — the same credential store the chat model uses (normally ~/.dsh/.credentials.yaml on your machine).api.deepseek.com endpoint.Tip: the plugin is only as safe as your key itself. If you ever shared the key elsewhere, rotate it in the DeepSeek platform and update it in Settings → Models.
| Symptom | Cause / fix |
|---|---|
Card shows 未配置 DEEPSEEK_API_KEY |
Store the key in Settings → Models (or export DEEPSEEK_API_KEY in the launching environment) |
Card shows HTTP 401 … |
The stored API key is invalid or expired |
| No card after install | The plugin row is missing from cordis.patch.yml, or DSH was not restarted |
| Balance never updates | node or curl not on PATH (both are normally present) |
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。