dsh-cost
已验证 · 实测可装 GiantGKL
功能简介
DSH token 成本统计插件。
可用 — 实测通过,早期项目
DSH token 成本统计插件。 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-cost
DSH plugin for the DeepSeek Harness: live conversation cost and DeepSeek account balance in the composer stats row. Currency follows the UI locale: RMB (¥) in the Chinese UI, USD ($) in the English UI.
Features
- Conversation cost: cumulative token usage over the whole session log × official DeepSeek pricing, shown as a live estimate —
¥ 0.0123in the Chinese UI,$ 0.0018in the English UI. Hover for the input/output/cache-read token breakdown and the pricing tier. - Account balance: queries the official DeepSeek
GET /user/balanceendpoint. A USD account is converted to RMB in the Chinese UI; a CNY account is converted to USD in the English UI (estimated rate, noted in the tooltip). Click to refresh, auto-poll every 60 s. - DeepSeek only: the cost hides itself for non-DeepSeek models; without a configured API key the balance shows "余额 — / Balance —".
- Supported models:
deepseek-v4-pro/deepseek-v4-flash/deepseek-chat/deepseek-reasoner(other DeepSeek models are estimated with the v4-pro tier).
Install
npm install dsh-cost
Then mount it in the deployment's cordis.yml (or a profile's cordis.patch.yml):
plugins:
- name: 'dsh-cost'
The web client is composed automatically via the dsh.client declaration (platform: web); no further configuration is required.
Config
The Host half follows the llm-deepseek adapter settings ($DSH_HOME/settings.yaml):
| Setting | Default | Meaning |
|---|---|---|
llm-deepseek.apiKeyEnv |
DEEPSEEK_API_KEY |
Credential reference (environment-variable name) for the API key, resolved through the credentials service ($DSH_HOME/.credentials.yaml / environment / .env) |
llm-deepseek.baseURL |
https://api.deepseek.com |
Base URL of the balance endpoint |
Without an API key the balance shows "余额 — / Balance —"; the cost display is unaffected.
Pricing (USD, per 1M tokens)
| Model | Input | Output | Cache read |
|---|---|---|---|
| deepseek-v4-pro | $0.435 | $0.87 | $0.003625 |
| deepseek-v4-flash | $0.14 | $0.28 | $0.0028 |
| deepseek-chat | $0.28 | $0.42 | $0.07 |
| deepseek-reasoner | $0.55 | $2.19 | $0.14 |
- Cache writes are billed at the input price (DeepSeek has no separate write fee).
- Official DeepSeek USD pricing (the v4 tiers match the deployment's bundled pi-ai data). In the Chinese UI the same tiers are displayed in RMB.
- Balance conversion uses the estimated rate 1 USD ≈ ¥6.79 (2026-08 central parity 6.7888). To follow official price or rate changes, edit the
PRICINGtable inlib/client.jsandUSD_CNYinlib/index.js.
Privacy
- The API key is resolved through the credentials service and used only to send the Bearer request to
api.deepseek.com— it is never logged, never placed on a command line, and never returned to the browser. - The balance route lives on the harness web server's same-origin path
/api/plugins/dsh-cost/balance; responses carry balance numbers only (no key) withCache-Control: no-store. - The balance request runs inside the Host process (native
fetch), not through a sandboxed subprocess.
Limitations
- DeepSeek models and the official DeepSeek balance endpoint only.
- Balance conversion uses a hard-coded estimated rate, not a live rate.
- The cost is an estimate based on official pricing (token counts come from the Harness
tokenUsageprojection; discounts and taxes are not included).
License
MIT © 2026 GiantGKL
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-cost」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
Web profile:
dsh plugin --profile web add dsh-cost Headless(CLI)profile:
dsh plugin --profile headless add dsh-cost 包信息
npm:dsh-cost · 版本 0.2.1 · 实测环境 dsh 0.1.0-rc.6
实测报告
端到端验证通过:dsh 0.1.0-rc.6 上 L1 安装 + L2 加载 + L3 运行问答。
使用场景
扩展 agent 的编码能力面——给它一个新工具、工作流或集成,让它接手以前做不了的开发任务。
适合谁
想让 dsh 在真实代码库上像队友一样干活的开发者——能改、能跑、能验证,而不只是回答问题。
二次开发建议
工具/命令面就是缝:暴露更多 SDK 能力、加更聪明的上下文接线,或收紧改代码与验证之间的循环。