Web UI 美元成本徽标:头部显示会话总成本、每条回复结尾显示该轮成本,悬停看分项。
安装
# npm 包(预构建)
dsh plugin --profile web add @steven-wu/dsh-cost-meter
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:Sttrevens/dsh-cost-meter
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Out-of-tree dsh plugin that shows a live USD cost badge for the open conversation in the Web UI.
It is a dual-face dsh.client package:
- Host half (
lib/index.js) registers asessionCostprojection on the session-projection seam. The fold tracks the current provider/model fromrequest/headerevents and accumulates cost from the provider-reported usage buckets (uncached input / output / cache-read / cache-write), reusing token-meter's "replace the same(turn, step)sample instead of double-counting" rule. The view exposes the whole-session totals plus abyTurnmap keyed by turn number. - Client half (
lib/client.js) registers a badge into theconversation.chat.assistant-actionsslot — the action row at the end of each assistant message, alongside the turn's time/duration info. Each badge shows that turn's cost; hovering opens a tooltip with the per-bucket breakdown (input / output / cache-read / cache-write) plus the session total.
Pricing table
Pricing is USD per million tokens, keyed by provider/model:
{
"per": 1000000,
"currency": "USD",
"default": { "input": 0.6525, "output": 1.9575, "cacheRead": 0.02175, "cacheWrite": 0 },
"models": {
"deepseek-official/deepseek-v4-pro": { "input": 0.6525, "output": 1.9575, "cacheRead": 0.02175, "cacheWrite": 0 },
"deepseek-official/deepseek-v4-flash": { "input": 0.2175, "output": 0.6525, "cacheRead": 0.00725, "cacheWrite": 0 }
}
}
The plugin reads ~/.dsh/cost-pricing.json on boot (override the path with the
DSH_COST_PRICING env var or the row's config.pricingPath). On first run it
writes the default table to that path; edit it and restart dsh web to apply
changes. A model without a models entry falls back to default (zero cost
when no default is present).
Install
The package declares a dsh.bundle manifest, so dsh plugin add installs it
and adds it to the profile's bundle layers automatically — no manual patch
edit:
dsh plugin --profile web add @steven-wu/dsh-cost-meter
# restart the web profile, then refresh the page
For a local checkout during development:
dsh plugin --profile web add file:/path/to/dsh-cost-meter
Notes:
@deepseek-ai/dsh-*are declared as peerDependencies (resolved from the harness), never asdependencies— installing them into a profile shadows the harness copy and can pull a stale dist-tag.- The Settings "Plugins" panel is read-only (inventory + config cards); install
happens only through
dsh plugin --profile … add. - Purely-cordis mounting (a
cordis.patch.ymlinsert row) also works — the shippedcordis.patch.ymlholds that row for either path.
The sessionCost projection is delivered through the same seam as
tokenUsage / sessionStats, so it also appears in every projection carrier
(history tail page, session/projection push frames) without extra wiring.
链接
同类插件
bowenliang123/dsh-context★ 1550
DSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
Han-1413141/dsh-cost-meter★ 340
会话与当日 API 费用统计、预算图框(已用%)、官方余额、历史看板,支持峰谷计价与官方价格一键同步。
wssfk12138/dsh-damage-pulse★ 211
在 DSH Web 界面追踪 DeepSeek Token 用量、单次与会话费用及账户余额,并显示缓存感知的扣费动画。
zh667/TokenLedger★ 203
侧边栏用量面板:把 Token 归属到实际服务该请求的中转站,站点从已有的 provider 配置中读出,无需额外配置;含今日/本月/累计三窗口、按站点与模型下钻、一年活跃度热力图,以及 New API / Sub2API / DeepSeek 余额。
Ychris12138/dsh-usage-stats★ 164
多供应商用量看板:按供应商/模型统计 Token 与日期下钻,统一展示账户余额,并追踪 OpenCode Go / Z.ai 订阅额度。
PolinniZhong/dsh-personal-center★ 120
DeepSeek Harness 个人中心:跨会话用量统计、按模型成本估算、全局自定义指令、外观全局字号、数据驱动的桌面宠物(位图/矢量皮肤)与会话状态概览,纯本地离线运行。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。