DeepSeek Harness Plugin Hub

Publish and manage complete Harness Profiles. Discover Plugins for your next setup.

Explore

PluginsPresetsDocsNews

Community

Publish a pluginContactReport an issue

Resources

Plugin Hub on GitHubDeepSeek HarnessSystem statusPrivacy notice
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

Independent and unofficial. Not affiliated with, authorized by, or endorsed by DeepSeek.

Token Budget — DSH Plugin for DeepSeek Harness
DeepSeek Harness Plugin Hub
ProfilesPluginsCategoriesNewsDocsSign inManage Profiles
ProfilesPluginsCategoriesNewsDocsSign in
← Plugins
T

dsh-token-budget

Token Budget

A per-conversation total-token safety fuse for DeepSeek Harness

The plugin will be installed here. Keep web if you are unsure.

npx -y @deepseek-ai/dsh plugin --profile web add github:Zyc20010326/dsh-token-budget#4d24b16d107097379960cf48e2f7fbce8a052c45
READMECompatibilityVersions
单次对话 Token 总预算

Compatibility and provenance

Token Budget is published as dsh-token-budget and currently resolves to version 0.2.0. The Hub verifies its manifest and preserves the exact installation source for reproducible installs.

DSH compatibility
*
Runtime surfaces
web
Release source
github
Registry updated
9/1/2026

Versions

0.2.0stable
9/1/2026

Related plugins

Loading related plugins…

Latest
0.2.0
DSH
*
HMR
Process restart
Tree shaking
Safe tree shaking not declared
Unpacked size
Unavailable
Files
Unavailable
Surface
web
License
MIT
Source
github
GitHub
★ 1
Weekly downloads
0
Last push
9/1/2026
View source ↗
README badge

Click the badge to copy Markdown for your README.

Do you maintain this Plugin?Claim benefit · Priority security scan

Verify the GitHub repository declared in package.json to manage this listing. After you claim it, Hub will prioritize a security scan of the current version and publish the result when it passes.

Claim this Plugin →
Report an issue

Related plugins

More verified plugins in models-usage.

Usage@linxin666/dsh-usageUsage statistics plugin for the dsh web GUI: per-provider balance and coding-plan quota detection plus a live token usage ledger, with the current session provider's today usage on the sidebar entryWhale Widgetdsh-whale-widgetDeepSeek balance whale widget in the bottom-right corner of the DSH Web interface: balance/today’s usage/peak-off-peak pricing, customizable bubble click sequence (text/balance/today/peak-off-peak/image/random phrases and parallel weighted selection), per-line styles and fonts, floating quick editinUsage Stats@ychris12138/dsh-usage-statsToken usage heatmap, provider balances, and subscription quotas for the dsh web GUICodex Connectdsh-codex-connectChatGPT OAuth and Codex models for DeepSeek Harness.

README

dsh-token-budget

给每次 AI 对话装一根 Token 保险丝。

在 DeepSeek Harness Web 输入框下方设定本次对话的总 Token 预算。每条用户消息都会获得一份独立预算;输入、缓存读写、模型思考和最终回答共同使用这份额度,达到上限后插件会停止继续请求或收紧本次生成长度。下一条用户消息自动重新计算。

单次对话 Token 总预算

它控制什么

本次对话总用量
= 每次模型请求的未缓存输入
+ 缓存读取
+ 缓存写入
+ 推理与最终回答

预算单位始终是“一条用户消息开始,到这次回答结束”,不是整个聊天历史,也不是某一个内部执行步骤。一次回答内部如果发生多次标准模型请求或重试,它们产生的 Token 都计入同一份预算。

例如设置 8,000 Token:

输入及缓存占用  1,500
模型思考占用    4,000
回答最多剩余    2,500
合计最多约为    8,000

若预计输入已经吃完预算,插件会在网络请求前停止;否则它会把模型的生成上限收紧到剩余额度。失败请求只要返回 usage 也会计入,流式 usage 与最终 message usage 不会重复统计。

安装

前置条件:Node.js ≥ 22.18、DeepSeek Harness CLI,并确保 pnpm 已加入 PATH。

直接从 GitHub 安装:

dsh plugin --profile web add github:Zyc20010326/dsh-token-budget
dsh web

也可以下载仓库 dist/ 中的预构建安装包,然后运行:

dsh plugin --profile web add ./dsh-token-budget-0.2.0.tgz
dsh web

从源码安装和验证:

git clone https://github.com/Zyc20010326/dsh-token-budget.git
cd dsh-token-budget
npm install
npm test
dsh plugin --profile web add .
dsh web

配置

用户界面只有一个选择:本次对话最多允许使用多少 Token。

Cordis 全局默认值仍可配置:

- id: token-budget
  name: dsh-token-budget
  config:
    enabled: true
    maxTokens: 8192
    minimumRequestTokens: 256
    safetyMarginTokens: 512
  • maxTokens:每条用户消息的默认总预算。
  • minimumRequestTokens:剩余额度低于该值时,不再发起一个几乎无法完成的模型请求。
  • safetyMarginTokens:为输入估算误差保留的安全余量。

Web 滑杆范围为 512–131072。调整后的值立即作用于当前回答尚未发出的请求,并作为当前会话中后续用户消息的默认预算。它只保存在当前 DSH 进程内;重启后恢复 Cordis 默认值。

从 v0.1.1 升级

v0.2.0 删除了 metric 和 scope。旧配置中的这两个字段应移除;插件现在固定使用“当前用户消息的总 Token 预算”,不再提供输出预算或整场会话预算模式。

精度边界

DeepSeek 服务端通常在请求完成后才返回精确输入 usage。插件在发送前使用 Harness Token Meter 估算输入,并额外扣除安全余量;完成后再用服务端 usage 校正已用量。

因此,本插件提供的是保守的单次对话总预算控制,不是数学意义上绝不偏差的计费硬上限。默认安全余量会降低超支概率,也可能让回答略早停止。若需要供应商账单层面的绝对财务上限,请同时配置 API 网关或账户额度。

覆盖范围

  • 覆盖同一 DSH 进程内、经过标准对话 Agent 请求边界的调用。
  • 一条用户消息内部的标准多次请求和重试会共同消耗本次预算。
  • 独立进程、绕过标准对话边界的直接 LLM 调用,以及标题生成等辅助调用不在这份预算内。
  • 子 Agent 是否计入父对话取决于 Harness 是否让其请求共享父 turn;独立 Agent 默认不会自动共享总账。

MIT License。