rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
LegifyX/dsh-usage
LegifyX fork of @linxin666/dsh-usage for DeepSeek Harness: signed-in DeepSeek account balance in every currency, deeprelay flat-plan subscription meters (monthly + rolling 7-day input/output) in the Usage tab and sidebar card, always-on peak marker, LAN trust. Upstream: zhu1090093659/dsh-web packages/dsh-usage.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:LegifyX/dsh-usage
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
Standalone usage plugin for DeepSeek Harness. Published as
@legifyx/dsh-usage, a fork of@linxin666/dsh-usagewith the Token Bank removed. It can be dropped into any DSH profile after disabling the copy that ships with the dsh-web bundle. See FORK.md for the change list and how to sync with upstream. Upstream:zhu1090093659/dsh-web, packagepackages/dsh-usage(Apache-2.0).
Add the package to the profile:
{ "dependencies": { "@legifyx/dsh-usage": "github:LegifyX/dsh-usage" } }
(or link:./plugins/dsh-usage for a local checkout), then run the profile's
package install.
If the dsh-web bundle is installed, disable its own usage row so the page
mounts once:
- id: web-ui-usage
disabled: true
Insert the standalone row:
- insert:
- id: dsh-usage
name: '@legifyx/dsh-usage'
Restart the host once. DSH builds its client-module manifest at boot, so a new package name is not served until the next start; after that, edits to this package hot-reload normally.
The plugin needs no other configuration: provider balances and plans are
discovered from the profile's llm-pi-ai routes and the credentials they name.
Token Usage Breakdown, Multi-Provider Balance & Cost Monitor for DeepSeek Harness (DSH)
Daily Token Analytics · Provider API Balance · Subscription Quotas · Peak/Off-Peak Costing
A dedicated token usage and cost monitoring plugin for DeepSeek Harness (DSH) Web GUI and official desktop client: multi-provider balances, coding subscription quota tracking, live token accounting ledgers, and a compact quick-glance card above settings in the sidebar.
The plugin runs a host-side service and a Usage page under Settings → Web Extensions (or a standalone first-level 使用统计 section when that parent is absent):
session/event streams (request/header route attribution plus assistant/message usage) into $DSH_HOME/dsh-usage/usage-ledger.json with day-based retention, so past days survive restarts; counting starts when the plugin is first enabled. For the official DeepSeek family the tab also shows the current peak/off-peak pricing period (Beijing weekdays 09:00-12:00 and 14:00-18:00 are peak, billed at double) and today's estimated spend in CNY; that line is toned by the current clock — red while peak, green while off-peak — and always carries the word plus a dot, so colour is never the only signal.llm-pi-ai records, apiKeyEnv references) and never reach the browser.Supported balance endpoints: DeepSeek (the official live route deepseek-official and the catalog alias deepseek both resolve), Moonshot (CN/international), OpenRouter, SiliconFlow (CN/international), ZenMux. Supported plan endpoints: Kimi For Coding, GLM Coding Plan (CN via open.bigmodel.cn, international via api.z.ai — the zai route the pi-ai catalog registers, plus the zai-coding / zai-coding-cn aliases; 5-hour, weekly and monthly windows, token-metered and credit-metered plans), OpenCode Go, MiniMax, Codex / ChatGPT subscription (OAuth access token from the pi-ai grant; a stale token shows an error until the harness next refreshes it). Providers without a programmatic endpoint (Qwen token plans, OpenCode Zen PAYG, Anthropic, OpenAI) are listed without facts.
Today's spend is an estimate priced at fold time from the published DeepSeek peak/off-peak price book (CNY per million tokens; peak = the windows above, off-peak half of peak). The rows in force are deepseek-flash (DeepSeek-V4.1-Flash) and deepseek-v4-pro: the retired flash ids (deepseek-v4-flash, deepseek-v4-flash-vision-exp) bill the flash row, and deepseek-v4-pro moves to that row once DeepSeek routes the id to V4.1-Flash on 2026-09-14 12:00 Beijing.
It covers the official DeepSeek routes only — relay traffic billed elsewhere (ZenMux, SiliconFlow, ...) stays unpriced — and unknown DeepSeek model ids take the flash-class row. Buckets recorded before a price change keep the old pricing, so a price-book update is reflected from the moment it ships, not retroactively.
The published rule bills a Chinese public holiday entirely off-peak even on a Monday-Friday, and bills an adjusted workday falling on a Saturday or Sunday off-peak too. Weekends are therefore already off-peak by construction, and this package ships the State Council holiday table (src/core/holidays.ts, 2020 through 2026, taken from the MIT-licensed chinese-holidays-node yearly data with only its holiday entries), so a public-holiday weekday is estimated at the off-peak row instead of reading up to about twice the real spend. A year the table does not cover (later than 2026) falls back to the published windows, which reads high rather than low — the safer direction to be wrong in.
Requires DSH 0.2.2-rc.1 or later: the plugin is developed against the 0.2.2-rc.1 DSH cohort (its settings page is the Host-generated page of the plugin's own Config schema) and its @deepseek-ai/* runtime imports are provided by the host itself.
In your profile (e.g. ~/.dsh/profiles/web):
pnpm add @linxin666/dsh-usage
and insert into cordis.patch.yml (or use the bundle patch):
- insert:
- id: usage
name: '@linxin666/dsh-usage'
Restart dsh web for the host half; the client half applies on refresh. A full family install opens Settings -> Web Extensions -> Usage; a standalone install keeps Settings -> Usage Statistics.
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch; off = no listeners, no probes, no routes |
pollIntervalSec |
60 |
Provider probe cycle (30-3600 s; a change reloads the plugin row) |
retainDays |
180 |
Ledger retention in local days (7-730) |
retainDays): pruned days drop out of both the trend chart and the note.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。