DeepSeek Harness 插件

dsh-budget-frozoai

Spend gate for DeepSeek Harness: refuses over-budget model calls on the llm/stream waterfall, before they are billed. Auto-downgrade past a soft limit.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
frozo-ai/dsh-budget
最近更新
2026年8月19日
分类
安全与权限
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/frozo-ai/dsh-budget
插件名:dsh-budget-frozoai
作者:frozo-ai

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器2 个文件
README.md来源说明 · 只读预览

dsh-cost-gate

Spend enforcement for DeepSeek Harness — not another dashboard.

The dsh ecosystem has plenty of cost plugins. Every one of them measures: ledgers, statistics, heatmaps, balance widgets. They tell you what you spent after you spent it.

This one stops the call.

        ┌─ over budget? ──> throw, before a single token is billed
llm/stream waterfall ─┼─ past 80%? ────> silently route to the cheap model
        └─ fine? ────────> pass through, then meter the usage chunk

llm/stream is a cordis waterfall — the decision happens before next() runs, which is the only place enforcement can actually work.

Install

dsh plugin --profile web add github:frozo-ai/dsh-budget   # npm: dsh-cost-gate
- insert:
    - id: budget
      name: 'dsh-cost-gate/plugin'
      config:
        limitUsd: 50
        period: monthly          # daily | monthly | total
        softFraction: 0.8        # start downgrading at 80%
        downgradeModel: 'deepseek/deepseek-chat'
        storePath: '~/.dsh/spend.json'
        rates:                   # USD per MILLION tokens
          'deepseek/deepseek-chat': { input: 0.28, output: 0.42 }
          'anthropic/claude-3.5-sonnet': { input: 3, output: 15 }

Set dryRun: true to log decisions without blocking — roll out safely, then turn it on.

Design notes

Integer micro-dollars. Costs accumulate as integers, never floats. A test runs 10,000 calls and asserts zero drift, because this decides whether people get blocked.

Cache tokens are disjoint. Per dsh's TokenUsage contract, cacheRead and cacheWrite are not included in inputTokens, so they're added at their own rates rather than folded in.

Atomic ledger writes. Temp file plus rename — a torn write must not lose budget state.

UTC period boundaries, so a daily budget resets at a time everyone agrees on.

Fails open, deliberately. No limitUsd means metering only. Enforcement is opt-in: a budget plugin that accidentally blocks your whole team is worse than one that doesn't block at all.

Related work

PerryLink/dsh-budget covers similar ground — metering, caps, alerts, carbon estimates, a Settings tab. If you want dashboards and reporting, look there first. This plugin is narrower on purpose: it gates the llm/stream waterfall so an over-budget call is refused before it is billed, and does little else.

Attribution

scopeBy: session          # deployment (default) | session | user
perScopeLimitUsd:
  'system:compaction': null    # unlimited — overhead must never block the agent
  'user:alice': 100

session uses GenerateOptions.sessionId, which dsh genuinely provides.

user needs a mapping dsh cannot supply — there is no user identity at the llm seam. So it is given, never guessed:

  • userEnv: 'DSH_USER' — one dsh instance per user
  • sessionUsers: { <sessionId>: 'alice' } — an operator-supplied map

An unattributable call lands in user:unattributed. It is never charged to whoever happens to be handy — a chargeback report that invents attributions is worse than one that admits gaps.

System overhead is separated. Compaction and session-title calls carry a purpose and are billed to system:*, so background work can never exhaust a person's budget. Give them a null limit so they cannot be blocked.

Known limitations

  • Per-user requires operator setup — see Attribution above. dsh has no user

concept at the llm seam, so nothing can infer it.

  • Unknown models price as $0 rather than crashing. Add them to rates.
  • Pricing tables are yours to maintain; providers change rates.

Test

npm test   # 29 checks: pricing, drift, periods, durability, decisions, attribution

MIT. Not affiliated with DeepSeek AI.