rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PerryLink/dsh-budget
Cost governance for DeepSeek Harness: token/cost metering per model, session and day, budget caps with threshold alerts and over-limit policies, carbon footprint estimation, per-model latency benchmarks, a Settings budget tab, and the /budget command. Maintenance status: FROZEN since 2026-10-05.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:PerryLink/dsh-budget
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.
Know what every session costs — before it costs you.
简体中文 · Español · Português · हिन्दी
dsh plugin --profile <name> add dsh-budget
Community plugin, not affiliated with DeepSeek. Canonical repository: https://github.com/PerryLink/dsh-budget (Gitee is a mirror).
main): dsh plugin --profile web add github:PerryLink/dsh-budget — the prepare script builds with production dependencies only.dsh plugin --profile web add dsh-budget.pnpm pack in this repo, then dsh plugin --profile web add ./dsh-budget-<version>.tgz.dsh plugin --profile web remove dsh-budget.If pnpm reports
ERR_PNPM_IGNORED_BUILDSfor this package (esbuild's harmless platform-binary validation), addallowBuilds: { esbuild: true }to yourpnpm-workspace.yaml— thedshCLI prints the exact snippet.
这个插件是 DSH 插件家族的一员(95 个,全部 Apache-2.0)。如果你在用,给个 star —— 它不会解锁任何功能,但会让下一个人在搜索里更容易找到它。
English: part of a 95 plugin family for DeepSeek Harness. If it is useful, a star helps the next person find it — nothing is gated behind it.
Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.
Know what every session costs — before it costs you.
Structure: usage arrives after the fact on session/event; checkBudgets walks session → daily → monthly; the over-limit disposal ends on the llm/stream seam, where a blocked scope short-circuits the next call — a passed call returns as the next usage sample. The examples below use the real command surface.
Frozen on 2026-10-05. No new features. This package still works, and it is not retired — but it no longer receives feature work. Only a genuine breakage will be fixed.
Maintainers treat this capability as one where the ecosystem has converged on a more widely adopted implementation, so effort has moved elsewhere. The comparison below was measured on 2026-10-05 and is recorded so nobody has to redo it.
| package | weekly downloads | |
|---|---|---|
| this package | dsh-budget |
1,079 |
| more widely adopted implementation | dsh-cost-meter |
33,526 |
| another alternative | dsh-usage-stats |
not measured |
| another alternative | @dougen/dsh-deepseek-usage |
6,019 |
Why it is the mainstream choice. dsh-cost-meter provides a 170+ model price catalog with automatic matching, and Coding-Plan quota lookup for 11 providers.
Compatibility. Its declared dsh peer range admits the 0.2.x line, so it loads on current hosts.
👉 For new work, dsh-cost-meter is the mainstream choice. Existing installs keep working unchanged; nothing is being removed.
Full evidence, including the host-version compatibility matrix: dsh-plugin-supersession-review-20261005.md.

measured 2026-10-05 · from the README's FROZEN maintenance table (npm weekly downloads)
| Surface | Status |
|---|---|
| Harness | DeepSeek Harness dsh-v0.2.1-alpha.1 (GitHub tag, adapted 2026-09-24; peer range >=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0 || >=0.1.7-0 <0.2.0): the alpha.2 catalog prices are built into the price table and unknown models surface as unpriced instead of a fabricated estimate; the audit gate keeps suppressing budget/alert/budget/block appends (fail-closed session event vocabulary). Verified 2026-09-24 by the two-ruler typecheck chain and the full local gate; the browser-panel items stay 人工·未测即未完成 (maintainer manual checklist). |
| Audit events | Written on harnesses before 0.1.2-rc.1; suppressed with a logged degradation reason on 0.1.2-rc.1 and later (fail-closed session event vocabulary, no external registration surface) || Node | ^22.19.0 \|\| >=24.0.0 |
| Surfaces | Host + Web client (Settings budget tab); /budget command |
dsh-budget turns the session event stream into a four-in-one cost governance loop:
config.prices.alert (notify only), block (short-circuit new model requests until the user lifts the block), degrade (block with corrective guidance naming the cheaper model from your degradation map)./budget command (/budget, /budget models, /budget unblock <scope>).dsh plugin --profile web add github:PerryLink/dsh-budget
# 1. install the bundle into your profile
dsh plugin --profile web add github:PerryLink/dsh-budget
# or from npm (published releases)
dsh plugin --profile web add dsh-budget
# 2. restart and verify the row
dsh --profile web --dump-config | grep -A2 'id: budget'
Then ask the agent: /budget — and watch the Settings tab fill in.
These are the plugin's real entry points; install once, then call one.
Command
/budget
Output
session: 5.00 USD / 10.00 USD (50% · 1000 tokens · 0.0010 kg CO2e)
daily: 60.00 USD / 50.00 USD (120% · 20000 tokens · 0.0200 kg CO2e) BLOCKED
monthly: 60.00 USD / unlimited (0% · 20000 tokens · 0.0200 kg CO2e)
deepseek/deepseek-chat: 0.05 USD (100 in / 50 out · p50 20ms · 0.0001 kg CO2e)
Observed from tests/command.spec.ts:14-62 (STATUS fixture and overview test); src/command.ts:65-88
Input
/budget unblock yearly
Output
usage: /budget [unblock session|daily|monthly | models]
Observed from plugins/dsh-budget/src/command.ts:35; plugins/dsh-budget/src/command.ts:99-103; plugins/dsh-budget/src/command.ts:128; plugins/dsh-budget/tests/command.spec.ts:49-50
/budget models/budget unblock <scope>All tunables are Schemastery Config fields (changeable from cordis.yml). cordis.patch.yml documents each key inline.
| Key | Default | Meaning |
|---|---|---|
prices |
{} |
Per-model USD prices per 1M tokens, merged over the built-in table |
defaultPrice |
unpriced signal (priced: false, zero numbers) |
Fallback for models absent from both tables: the default contributes 0 to accounting and surfaces as "unpriced"; set numbers with priced: true to price unknown models explicitly |
budgets.session / daily / monthly |
10 / 50 / 500 |
Budget caps in USD per scope; omit for unlimited |
warnRatio |
0.8 |
Alert once usage reaches this fraction of a cap (0..1) |
overLimit |
alert |
alert / block / degrade after a cap is crossed |
degradation |
{} |
Model id → cheaper model id of the same provider |
degradeThinking |
true |
Above warnRatio (and before a hard block), send DeepSeek requests with reasoningEffort: 'off' to slow spending; the hard block semantics are unchanged |
webhookUrl |
(none) | Optional webhook URL for threshold alerts (POST JSON) |
webhookTimeoutMs |
5000 |
Webhook request timeout |
alertsEnabled |
true |
Master switch for threshold alerts |
alertCooldownMs |
3600000 |
Minimum ms between two alerts of the same scope |
desktopNotifications |
false |
Browser desktop notifications while the tab is open |
refreshIntervalMs |
5000 |
Settings tab polling interval |
carbon.enabled / region / pue / energyKwhPerToken |
true / global / 1.58 / 0.000007 |
Carbon bridge (regions: global, us, eu, china, india, uk, france, iceland) |
latency.enabled / windowSize |
true / 200 |
Per-model latency percentiles and their window |
currency |
{code: USD, rate: 1.0, decimals: 2} |
Display currency (costs are computed in USD) |
outputLanguage |
en |
/budget output language: en / zh |
historyDays |
30 |
Per-day usage history kept in the panel snapshot |
persistence.enabled / intervalMs |
true / 10000 |
Durable day/month persistence across restarts (storage domain); degrades to in-memory when the domain is absent |
| Surface | Kind | Notes |
|---|---|---|
/budget |
Command | Per-scope overview (usage, ratio, carbon, blocked state) |
/budget models |
Command | Per-model breakdown with latency percentiles and the thinking share (reasoningTokens / outputTokens, n/a when the host omits it) |
/budget unblock <scope> |
Command | Lift a blocked scope (session / daily / monthly) |
| Settings → Plugins → Budget | Settings tab | Usage bars, per-day usage curve, model breakdown, alerts, cap editors, unblock buttons |
budget/status, budget/setSettings, budget/unblock |
Typert Remote | The client channel (the tab consumes these) |
network:outbound (the optional alert webhook only), session:append (audit events), native-code:none.budget/alert, budget/block, and budget/degrade are log-only audit events carrying scope names and USD amounts (microtask-deferred past the session-append reentrancy guard). On harnesses 0.1.2-rc.1 and later they are not written — the fail-closed event vocabulary rejects logs with unregistered event types and offers no external registration surface — so the audit trail degrades to the budget logger and webhook only.llm/stream waterfall — the plugin never invents model output.degrade therefore names the target model in the corrective message instead of swapping the request. The one request-level rewrite is degradeThinking: above warnRatio (and before a block) the request is re-dispatched from a shallow copy with reasoningEffort: 'off'; the hard block keeps its exact semantics.block/degrade rely on the llm/stream waterfall; harness builds without that seam cannot block requests (alerts still work).config.prices if you bill off-peak.reasoningTokens show the thinking share as n/a rather than a fabricated 0%.pnpm install # node ^22.19 || >=24
pnpm run typecheck # tsc: src + tests against the local harness checkout
pnpm run typecheck:ci # tsc against the published types (no paths)
pnpm test # vitest
pnpm run build # tsc declarations + tsdown bundles (lib/)
pnpm run verify:self-contained # dependency specs resolve from the registry
pnpm run verify:artifacts # built ESM face + typert manifest + client bundle
pnpm pack # the published tarball
Verified against DSH 0.2.0-rc.2 (the runtime this README ships for) and the high-star plugin set surveyed on 2026-10-05.
This plugin does not interfere with other plugins, including the widely installed high-star ones:
budget; that key is not a built-in seam and is not provided by any surveyed high-star plugin.shadows-shipped-ui seat.webServer prefix.inserts its own row; it never overrides a built-in row's config.process.env, or replace the global fetch dispatcher.Shared event listeners are non-interfering by construction. It observes the ordering-sensitive event llm/stream with ctx.on() — Cordis's broadcast registration, where every listener runs and none can starve another. Every listener here delegates through next(), so the chain is never short-circuited, and a mutation is applied to the value next() produced rather than returned in its place:
llm/stream — also used by dsh-routing-suite (7000★).Static evidence: dsh-plugin-doctor K10–K13 report pass for every check on this repository.
dsh, dsh-plugin, deepseek-harness, deepseek, cordis, budget, cost-tracking, carbon-footprint, latency-benchmark, token-usage
This project is part of the DeepSeek Harness plugin family from PerryLink. The roster stays collapsed below so every README keeps a short first screen; expand it to see every row and its status.
Apache License 2.0 © 2026 dsh-budget contributors
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek、deepseek-harness。