New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

dsh-budget

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsh-budget

Cost governance for DeepSeek Harness: aggregated token/cost metering per model, session and day, session/daily/monthly budget caps with threshold alerts (desktop notification + webhook) and alert/block/degrade over-limit policies, built-in carbon footprin

latest
Source
npmnpm
Version
0.4.17
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

💰 dsh-budget

  • 1024 store channel: npm i -g dsh1024 once, then dsh1024 plugin --profile web add dsh-budget (counts toward the deepseek1024.com install ranking). Gitee dshfind OpenSSF Scorecard

Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.

Know what every session costs — before it costs you.

Official repository. This is the only official repository of dsh-budget, maintained by PerryLink. Same-name repositories under other accounts are not affiliated.

License DSH plugin dsh-doctor DSH Market Node CI Version npm version npm downloads

English · 简体中文 · Español · Português · हिन्दी

📖 Ecosystem knowledge base — measured data, not marketing: plugin development guide · plugin-selection data · maintenance criteria.

⭐ 如果它帮到了你

这个插件是 DSH 插件家族的一员(40+ 个,全部 Apache-2.0)。如果你在用,给个 star —— 它不会解锁任何功能,但会让下一个人在搜索里更容易找到它。

English: part of a 40+ plugin family for DeepSeek Harness. If it is useful, a star helps the next person find it — nothing is gated behind it.

What is dsh-budget?

Cost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.

Know what every session costs — before it costs you.

Terminal demo of dsh-budget: dsh-budget — install, then /budget and /budget models

Animated terminal demo of dsh-budget

The same run, animated.

Maintenance status: 🧊 FROZEN

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 better-adopted alternatives now exist, so effort has moved elsewhere. The comparison below was measured on 2026-10-05 and is recorded so nobody has to redo it.

packageweekly downloads
this packagedsh-budget1,079
better-adopted alternativedsh-cost-meter33,526
another alternativedsh-usage-statsnot measured
another alternative@dougen/dsh-deepseek-usage6,019

Why the alternative leads. 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, prefer dsh-cost-meter. Existing installs keep working unchanged; nothing is being removed.

Full evidence, including the host-version compatibility matrix: dsh-plugin-supersession-review-20261005.md.

Comparison

Measured comparison chart for dsh-budget

measured 2026-10-05 · from the README's FROZEN maintenance table (npm weekly downloads)

Compatibility

SurfaceStatus
HarnessDeepSeek Harness dsh-v0.2.1-alpha.1 (GitHub tag, adapted 2026-09-24; peer range `>=0.1.2-rc.1 <0.2.0

| 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 |

What you get

dsh-budget turns the session event stream into a four-in-one cost governance loop:

  • Aggregated metering — tokens (uncached input / output / cache read / cache write), estimated USD cost, and carbon footprint per model, session, and day, priced through a built-in USD-per-1M table merged with your config.prices.
  • Budget governance — session/daily/monthly caps; a warn-ratio threshold alert (webhook POST + desktop-notification flag) and three over-limit policies: 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).
  • Carbon & latency — token→carbon bridge (tokens × kWh/token × PUE × regional grid intensity, ported from AI-Carbon-Footprint-Calculator) and per-model latency percentiles.
  • Surfaces — the Settings budget tab (usage bars, per-day usage curve, model breakdown, alerts, cap editors, unblock buttons) and the /budget command (/budget, /budget models, /budget unblock <scope>).

Quick start

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.

Install & uninstall

  • git channel (latest main): dsh plugin --profile web add github:PerryLink/dsh-budget — the prepare script builds with production dependencies only.
  • npm channel (published releases): dsh plugin --profile web add dsh-budget.
  • tarball channel: pnpm pack in this repo, then dsh plugin --profile web add ./dsh-budget-<version>.tgz.
  • uninstall: dsh plugin --profile web remove dsh-budget.

If pnpm reports ERR_PNPM_IGNORED_BUILDS for this package (esbuild's harmless platform-binary validation), add allowBuilds: { esbuild: true } to your pnpm-workspace.yaml — the dsh CLI prints the exact snippet.

Configuration

All tunables are Schemastery Config fields (changeable from cordis.yml). cordis.patch.yml documents each key inline.

KeyDefaultMeaning
prices{}Per-model USD prices per 1M tokens, merged over the built-in table
defaultPriceunpriced 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 / monthly10 / 50 / 500Budget caps in USD per scope; omit for unlimited
warnRatio0.8Alert once usage reaches this fraction of a cap (0..1)
overLimitalertalert / block / degrade after a cap is crossed
degradation{}Model id → cheaper model id of the same provider
webhookUrl(none)Optional webhook URL for threshold alerts (POST JSON)
webhookTimeoutMs5000Webhook request timeout
alertsEnabledtrueMaster switch for threshold alerts
alertCooldownMs3600000Minimum ms between two alerts of the same scope
desktopNotificationsfalseBrowser desktop notifications while the tab is open
refreshIntervalMs5000Settings tab polling interval
carbon.enabled / region / pue / energyKwhPerTokentrue / global / 1.58 / 0.000007Carbon bridge (regions: global, us, eu, china, india, uk, france, iceland)
latency.enabled / windowSizetrue / 200Per-model latency percentiles and their window
currency{code: USD, rate: 1.0, decimals: 2}Display currency (costs are computed in USD)
outputLanguageen/budget output language: en / zh
historyDays30Per-day usage history kept in the panel snapshot
persistence.enabled / intervalMstrue / 10000Durable day/month persistence across restarts (storage domain); degrades to in-memory when the domain is absent

Tools & surfaces

SurfaceKindNotes
/budgetCommandPer-scope overview (usage, ratio, carbon, blocked state)
/budget modelsCommandPer-model breakdown with latency percentiles
/budget unblock <scope>CommandLift a blocked scope (session / daily / monthly)
Settings → Plugins → BudgetSettings tabUsage bars, per-day usage curve, model breakdown, alerts, cap editors, unblock buttons
budget/status, budget/setSettings, budget/unblockTypert RemoteThe client channel (the tab consumes these)

Permissions & data

  • Permissions: network:outbound (the optional alert webhook only), session:append (audit events), native-code:none.
  • Data: everything displayed comes from the session event stream; the only host-side network call is the configured webhook, whose URL is validated at load and credential-stripped before any log. No prompts or payloads ever leave the host.
  • Session log: budget/alert and budget/block 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.

Security boundaries

  • No fabrication: a budget block yields a corrective error finish on the llm/stream waterfall — the plugin never invents model output.
  • No request rewriting: loop-built requests are frozen; degrade therefore names the target model in the corrective message instead of swapping the request.
  • Fail loud: invalid prices, URLs, ratios, regions, and bounds fail the mount.
  • Honest scope: runtime edits from the panel are session-scoped; a reload restores the cordis.yml values.

Known limitations

  • Aggregation is process-local: usage resets when the harness restarts (per-day/per-month buckets rebuild from the current session log view).
  • block/degrade rely on the llm/stream waterfall; harness builds without that seam cannot block requests (alerts still work).
  • Built-in prices drift; override entries via config.prices.

Development

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

Interoperability with other DSH plugins

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:

  • No tool-name collision. Every tool is namespaced; no bare name owned by a shipped tool or another plugin is registered.
  • No service-key collision. It provides budget; that key is not a built-in seam and is not provided by any surveyed high-star plugin.
  • No slot collision. It registers no client slot key, so it cannot contend for a shadows-shipped-ui seat.
  • No HTTP route collision. It registers no webServer prefix.
  • No patch-layer collision. The bundle patch only inserts its own row; it never overrides a built-in row's config.
  • No global mutation. It does not patch prototypes, rewrite 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.

Topics

dsh, dsh-plugin, deepseek-harness, deepseek, cordis, budget, cost-tracking, carbon-footprint, latency-benchmark, token-usage

Contributors

  • @PerryLink — creator and maintainer: aggregation, budget governance, carbon and latency ports, the Settings tab, and the five-language docs.

This project is one of the 33 actively maintained DeepSeek Harness plugins from PerryLink — the roster is 42, of which 6 are frozen and 3 retired; every one keeps its row below, with the reason in the Status column. If this one helps you, the others likely will too:

PluginOne-linerStatus
dsh-auto-reviewSecond-model auto-review on the approval chain, fail-closed by default
dsh-autotierAutomatic strong/cheap model-tier routing with deterministic risk guards and a /tier command
dsh-background-agentsDurable background child agents with a Web UI sidebar, messaging and interrupt🚫 RETIRED — see the note above
dsh-budgetCost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.🧊 FROZEN — see the repo README
dsh-catalogDSH Desktop Market standard catalog source for the PerryLink family
dsh-cert-mcpRead-only MCP server exposing the certification registry: grades, snapshots and five-dimension evidence
dsh-checkpoint-rewindClaude Code /rewind-equivalent: snapshots, session forks, one-shot restore
dsh-claude-moveMigrate Claude Code sessions, memory, skills and CLAUDE.md into DSH🧊 FROZEN — see the repo README
dsh-clickCross-platform native desktop control for DeepSeek Harness — Windows first.
dsh-composer-historyTerminal-style input history for the web composer: arrows, Ctrl+R search
dsh-data-qualityDataset quality checks and citation cross-checks (the optional numeric bridge consumed here)
dsh-defendPrompt-injection, jailbreak, and secret-leak defense for DeepSeek Harness.🧊 FROZEN — see the repo README
dsh-doublecheckEngineering-discipline guard: requirements grill, test gates, adversary review
dsh-drawUnified static-image generation routing for DeepSeek Harness.🧊 FROZEN — see the repo README
dsh-fastRead-only performance diagnostics for DeepSeek Harness.
dsh-fund-researchDeterministic research reports for Chinese public mutual funds
dsh-githubGitHub PR/issues integration for DSH, every write gated by approval
dsh-industry-researchIndustry research orchestration that seals its deliverables through this plugin's ctx.researchReport.assemble
dsh-layaLaya typed decisions (noul/choice/score) as a first-class Cordis service and model-visible tools
dsh-libraryLocal document knowledge base for DeepSeek Harness.
dsh-local-aiLocal-model (Ollama) integration for DeepSeek Harness.
dsh-lsp-actionsLSP diagnostics, formatting, completion, code actions and rename over language servers
dsh-maskPII masking middleware: anonymize at the model boundary, restore at the display layer
dsh-mcp-panelRead-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors
dsh-mementoApproval-gated cross-session memory: ctx.memory seam + SQLite + memory tool🧊 FROZEN — see the repo README
dsh-observeOpenTelemetry and Langfuse observability exporter for DeepSeek Harness.
dsh-output-stylesClaude Code outputStyles-equivalent runtime style switching
dsh-permission-rulesClaude Code-style declarative allow/deny/ask permission rules with audit
dsh-plugin-certificationCommunity certification registry with repro-checkable grades and badges
dsh-plugin-doctorZero-dependency static + sandbox smoke detector for DSH plugins
dsh-plugin-guidePlugin-development knowledge base as an on-demand agent skill
dsh-plugin-kitShared zero-runtime-dependency toolkit for the PerryLink DSH plugins
dsh-plugin-upgradeOne-package, one-corridor-index plugin upgrade skill: routes a repository to the matching closed corridor card
dsh-plugin-upgrade-015Merged 0.1.3-alpha.1 → 0.1.5-rc.1 upgrade corridor card plus a zero-dependency seam scanner🚫 RETIRED — corridors carried by dsh-plugin-upgrade
dsh-reachMulti-channel approval/question bridge: WeChat/Telegram/Feishu, session console🧊 FROZEN — see the repo README
dsh-research-reportVerifiable research-report engine: content-addressed evidence ledger and sealed versions
dsh-scoreMulti-dimensional quality scoring for DeepSeek Harness plugins.
dsh-session-pinPin sessions in the Web sidebar with durable ordering🚫 RETIRED — see the note above
dsh-session-syncCross-device session sync for DeepSeek Harness — a dedicated git mirror of your session store.
dsh-skill-pack-securitySecurity-audit skill pack: secret scan, dependency and supply-chain review
dsh-talkVoice-first session loop for DeepSeek Harness: talk to it, hear it answer.
dsh-team-roomsCross-session team rooms: shared message bus, task board and timeline🚫 RETIRED — see the note above
dsh-test-driveIsolated install-and-smoke test drives for DeepSeek Harness plugins.
dsh-ticktickTickTick/Dida365 task bridge: session-header panel + 11 tools
dsh-translateVendor parameter translation and deterministic JSON repair for DeepSeek Harness.

Install from the DSH Desktop Market

All PerryLink plugins are browsable in the built-in DSH Desktop Market: Market → Sources → add source → paste https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → select it. Installation still goes through the Market's npm-identity verification and your confirmation.

License

Apache License 2.0 © 2026 dsh-budget contributors

Keywords

dsh

FAQs

Package last updated on 10 Oct 2026

Related posts