@steven-wu/dsh-cost-meter
dsh 插件:根据提供商令牌使用情况和可配置定价表,实时显示 USD 成本徽章(整个会话 + 每次轮次)。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Sttrevens/dsh-cost-meter说明文档
阅读完整 README ↗@steven-wu/dsh-cost-meter
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: