全部插件

dsh-budget

dsh-budget · 版本 0.4.17 · 更新于 2026年11月29日

通过 1024 商店安装时,先执行一次 npm i -g dsh1024,再执行 dsh1024 plugin --profile web add dsh-budget。安装计入 deepseek1024.com 的安装排行榜。

  • 逐版审核
  • 开发运行时
  • Apache-2.0
  • 0次下载

说明

以下为插件作者提供的原文。

💰 dsh-budget

  • 1024 商店渠道:先 npm i -g dsh1024,再 dsh1024 plugin --profile web add dsh-budget(计入 deepseek1024.com 安装排行)。

DeepSeek Harness 的成本治理:预算、碳足迹与延迟,一个面板全览。

让每次会话的成本在超支之前就被看清。

官方仓库。 本仓库是 dsh-budget 的唯一官方仓库,由 PerryLink 维护。其他账号下的同名仓库与本项目无关。

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

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


📖 生态实测知识库(实测数据,不是营销):插件开发指南 · 选型实测数据 · 维护取舍判据。

What is dsh-budget?

DeepSeek Harness 的成本治理:预算、碳足迹与延迟,一个面板全览。

让每次会话的成本在超支之前就被看清。

dsh-budget 终端演示:dsh-budget — install, then /budget and /budget models

Animated terminal demo of dsh-budget

同一次运行,动图版。

维护状态:🧊 已冻结

2026-10-05 起冻结,不再新增功能。 本包仍可正常使用,没有退役——但不再投入功能开发,只有真实故障才会修复。

维护者判定该能力面已出现采用度更高、更值得推荐的替代方案,因此把精力移到了别处。

包周下载量
本包dsh-budget1,079
更值得推荐的替代品dsh-cost-meter33,526
另一个替代品dsh-usage-stats未测
另一个替代品@dougen/dsh-deepseek-usage6,019

为什么替代品更强。 dsh-cost-meter 提供 170+ 模型的价目目录与自动匹配,并支持 11 家主流 Coding Plan 的订阅额度查询。

👉 新工作请优先使用 dsh-cost-meter。 已安装的照常可用,没有任何东西被移除。

完整证据(含宿主版本兼容矩阵)见 dsh-plugin-supersession-review-20261005.md;英文版见 README.md 的 Maintenance status: 🧊 FROZEN 一节。

⭐ 如果它帮到了你

这个插件是 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.

Comparison

dsh-budget 的实测对比柱状图

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

兼容性

方面状态
HarnessDeepSeek Harness dsh-v0.2.1-alpha.1(GitHub tag,2026-09-24 已适配;peer 范围 `>=0.1.2-rc.1 <0.2.0

| 审计事件 | 0.1.2-rc.1 之前的宿主上写入;在 0.1.2-rc.1 及以后抑制并记录降级原因(fail-closed 会话事件词表,无外部注册面) || Node | ^22.19.0 \|\| >=24.0.0 | | 界面 | Host + Web 客户端(设置页预算页签);/budget 命令 |

你能得到什么

dsh-budget 把会话事件流变成四合一成本治理闭环:

  • 聚合计量 —— token(未缓存输入 / 输出 / 缓存读 / 缓存写)、估算 USD 成本与碳足迹,按模型/会话/天聚合;内置 USD/百万 token 价目表与 config.prices 合并定价。
  • 预算治理 —— 会话/日/月三档封顶;warnRatio 阈值告警(webhook POST + 桌面通知开关)与三种超限策略:alert(仅告警)、block(在用户解除前短路新模型请求)、degrade(阻断并给出指向 degradation 映射中更便宜模型的修正提示)。
  • 碳足迹与延迟 —— token→碳桥接(tokens × kWh/token × PUE × 区域电网强度,移植自 AI-Carbon-Footprint-Calculator)与按模型延迟百分位。
  • 界面 —— 设置页预算页签(用量条、按天用量曲线、模型明细、告警、上限编辑、解除阻断按钮)与 /budget 命令(/budget、/budget models、/budget unblock <scope>)。

快速开始

sole plugin --profile web add github:PerryLink/dsh-budget
# 1. 把 bundle 装进你的 profile
sole plugin --profile web add github:PerryLink/dsh-budget

# 或从 npm 安装(正式发布版)
sole plugin --profile web add dsh-budget

# 2. 重启并核实行
dsh --profile web --dump-config | grep -A2 'id: budget'

然后在会话里输入 /budget,并在设置页查看预算页签。

安装与卸载

  • git 通道(最新 main):sole plugin --profile web add github:PerryLink/dsh-budget —— prepare 脚本仅用生产依赖构建。
  • npm 通道(正式发布版):sole plugin --profile web add dsh-budget。
  • tarball 通道:在本仓库执行 pnpm pack,然后 sole plugin --profile web add ./dsh-budget-<version>.tgz。
  • 卸载:sole plugin --profile web remove dsh-budget。

如果 pnpm 对本包报 ERR_PNPM_IGNORED_BUILDS(esbuild 的平台二进制无害校验),在你的 pnpm-workspace.yaml 中加入 allowBuilds: { esbuild: true } —— dsh CLI 会打印确切片段。

配置

所有可调项都是 Schemastery Config 字段(可在 cordis.yml 中修改)。cordis.patch.yml 内联说明每个键。

键默认值含义
prices{}每模型 USD/百万 token 价格,合并覆盖内置价目表
defaultPrice未定价信号(priced: false,数字为零)两表均无该模型时的回退:默认对记账贡献 0 并显示「未定价」;设置数字并加 priced: true 可为未知模型显式定价
budgets.session / daily / monthly10 / 50 / 500各作用域 USD 预算上限;缺省表示不限
warnRatio0.8用量达到上限该比例时告警(0..1)
overLimitalert超限后策略:alert / block / degrade
degradation{}模型 id → 同厂商更便宜模型 id 的映射
webhookUrl(无)可选阈值告警 webhook URL(POST JSON)
webhookTimeoutMs5000webhook 请求超时
alertsEnabledtrue阈值告警总开关
alertCooldownMs3600000同一作用域两次告警的最小间隔(ms)
desktopNotificationsfalse页签打开时的浏览器桌面通知
refreshIntervalMs5000设置页签轮询间隔
carbon.enabled / region / pue / energyKwhPerTokentrue / global / 1.58 / 0.000007碳桥接(区域:global, us, eu, china, india, uk, france, iceland)
latency.enabled / windowSizetrue / 200按模型延迟百分位与其窗口
currency{code: USD, rate: 1.0, decimals: 2}展示货币(成本以 USD 计算,仅展示换算)
outputLanguageen/budget 输出语言:en / zh
historyDays30面板快照保留的按天用量历史天数
persistence.enabled / intervalMstrue / 10000日/月用量跨重启持久化(storage 域);域缺失时降级为进程内聚合

工具与界面

界面类型说明
/budget命令各作用域概览(用量、比例、碳足迹、阻断状态)
/budget models命令按模型明细 + 延迟百分位
/budget unblock <scope>命令解除某作用域阻断(session / daily / monthly)
设置 → 插件 → 预算设置页签用量条、按天用量曲线、模型明细、告警、上限编辑、解除阻断按钮
budget/status、budget/setSettings、budget/unblockTypert Remote客户端通道(页签消费这些方法)

权限与数据

  • 权限:network:outbound(仅可选告警 webhook)、session:append(审计事件)、native-code:none。
  • 数据:展示内容全部来自会话事件流;主机侧唯一网络调用是配置的 webhook,URL 在加载时校验、入日志前剥离凭据。任何 prompt/载荷都不会离开主机。
  • 会话日志:budget/alert 与 budget/block 是仅日志审计事件,只携带作用域名与 USD 金额(微任务延后以绕过会话 append 重入保护)。在 0.1.2-rc.1 及以后的宿主上不再写入——fail-closed 事件词表会拒绝含未注册事件类型的日志,且没有外部注册面——审计轨迹因此仅降级到预算日志与 webhook。

安全边界

  • 不伪造数据:预算阻断在 llm/stream 瀑布上产出修正性错误 finish —— 插件绝不编造模型输出。
  • 不改写请求:loop 构建的请求被冻结;degrade 因此在修正消息中点名目标模型,而非替换请求。
  • 失败大声:非法价格、URL、比例、区域与边界在挂载时即失败。
  • 如实作用域:面板的运行时编辑仅会话级生效;重载后恢复 cordis.yml 配置。

已知限制

  • 聚合为进程本地:harness 重启后用量清零(日/月桶从当前会话日志视图重建)。
  • block/degrade 依赖 llm/stream 瀑布;无此 seam 的构建无法阻断请求(告警仍有效)。
  • 内置价目会漂移;用 config.prices 覆盖条目。

开发

pnpm install        # node ^22.19 || >=24
pnpm run typecheck  # tsc:src + tests,对照本地 harness checkout
pnpm run typecheck:ci  # tsc:对照已发布的 0.1.7-rc.2 类型(无 paths)
pnpm test           # vitest
pnpm run build      # tsc 声明 + tsdown bundles(lib/)
pnpm run verify:self-contained  # 依赖声明全部来自 registry
pnpm run verify:artifacts       # 构建产物 ESM 面 + typert manifest + 客户端 bundle
pnpm pack           # 发布用 tarball

与其他 DSH 插件的互操作

已对照 DSH 0.2.0-rc.2(本 README 面向的运行时)与 2026-10-05 实测的高星插件集验证。

本插件不干扰其他插件,包括广泛安装的高星插件:

  • 无工具名冲突。 所有工具都带命名空间,不占用任何已被内置工具或其他插件持有的裸名。
  • 无服务键冲突。 只提供 budget;该键既不是内置 seam,也没有被任何已调研的高星插件提供。
  • 无 slot 冲突。 不注册客户端 slot key,因此不参与 shadows-shipped-ui 座位争抢。
  • 无 HTTP 路由冲突。 不注册任何 webServer 前缀。
  • 无 patch 层冲突。 组合包 patch 只 insert 自己那一行,从不覆写内置行的 config。
  • 无全局改写。 不改原型、不改写 process.env、不替换全局 fetch dispatcher。

共享事件监听器在构造上就不互相干扰。 它用 ctx.on() 监听顺序敏感事件 llm/stream —— Cordis 的广播语义:每个监听器都会运行,任何一个都无法饿死其他监听器。此处每个监听器都通过 next() 委托,因此链条绝不会被短路;改写作用在 next() 产出的值上,而不是用它顶替返回:

  • llm/stream — also used by dsh-routing-suite (7000★).

静态证据:dsh-plugin-doctor 的 K10–K13 在本仓全部为 pass。

Topics

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

Contributors

  • @PerryLink —— 创建者与维护者:聚合、预算治理、碳足迹与延迟移植、设置页签与五语文档。

PerryLink DSH Plugin Family

本项目是 PerryLink 维护的 DeepSeek Harness 插件家族成员:34 个活跃维护,名册共 42 个,其中 5 个已冻结、3 个已退役——每一个都在下表保留自己的行,原因见「状态」列。如果它能帮到你,其他的也会:

Plugin一句话状态
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🚫 已退役 — 见上方说明
dsh-budgetCost governance for DeepSeek Harness: budgets, carbon, and latency in one panel.🧊 已冻结 — 见仓库 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🧊 已冻结 — 见仓库 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.🧊 已冻结 — 见仓库 README
dsh-doublecheckEngineering-discipline guard: requirements grill, test gates, adversary review
dsh-drawUnified static-image generation routing for DeepSeek Harness.🧊 已冻结 — 见仓库 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
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🚫 已退役 —— 走廊由 dsh-plugin-upgrade 承担
dsh-reachMulti-channel approval/question bridge: WeChat/Telegram/Feishu, session console🧊 已冻结 — 见仓库 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🚫 已退役 — 见上方说明
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🚫 已退役 — 见上方说明
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.

License

Apache License 2.0 © 2026 dsh-budget contributors

从 DSH Desktop 市场安装

所有 PerryLink 插件均可在 DSH Desktop 内置市场中浏览:市场 → 来源 → 添加来源 → 粘贴 https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json → 选中。安装仍需通过市场的 npm 身份校验与你的确认。

版本历史

  • 0.4.172026年11月29日 · 390 KB
dsh-budget · SoleAPI Agent 插件 | SoleAPI