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 来源的插件在安装时会在你的机器上执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
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.435, "output": 0.87, "cacheRead": 0.003625, "cacheWrite": 0 },
"models": {
"deepseek-official/deepseek-v4-pro": { "input": 0.435, "output": 0.87, "cacheRead": 0.003625, "cacheWrite": 0 },
"deepseek-official/deepseek-v4-flash": { "input": 0.14, "output": 0.28, "cacheRead": 0.0028, "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.
链接
同类插件
zhu1090093659/dsh-web-ui★ 1766
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
ccch1mneyyy/dsh-TUI★ 829
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
omdsh-dev/DSH-better-sidebar★ 705
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
huiliyi37/dsh-tianshu-tui★ 131
DeepSeek Harness 的终端 UI(TUI)。
omdsh-dev/dsh-at-file★ 117
Codex 风格的 `@file` 文件引用,输入框里直接搜索并引用工作区文件。
Nagi-ovo/dsh-visualize★ 79
对话内生成式 UI:模型把交互式 HTML 卡片直接画进会话流,带流式预览与沙箱渲染。