Community plugin

yib0601 / @local/dsh-turn-cost

DSH 插件:逐轮/会话费用(官方单价 CNY/USD + 峰谷分时)+ 上下文洞察面板(仪表盘 / 上下文页签 / /context 命令)

  • JavaScript
  • License not detected
  • 0 stars
  • Nov 22, 2026

About this plugin

Written by the registry from verified metadata, not from the README.

@local/dsh-turn-cost is a DSH plugin published from the yib0601/dsh-turn-cost repository.

  • Listing statusManifest verified
  • Manifest checkedNov 20, 2026
  • Package@local/dsh-turn-cost
  • Package version1.8.0
  • Source commit0199990
  • Repository createdNov 18, 2026

Capabilities and topics

cost-trackingdashboarddeepseekdeepseek-harness
From the repository README

README

Everything below this line is the repository's own document, cached here. This site did not write or review it.

Cached versionView on GitHub

dsh-turn-cost

dsh plugin topics version

DSH 插件(dsh-plugin)。标签:dsh · dsh-plugin · deepseek-harness · deepseek · plugin · cost-tracking · token-usage · llm-pricing · dashboard

给 DeepSeek Harness(DSH)Web 端加两个能力:按官方单价把每一轮的 token 用量换算成钱,以及跨会话「用量总览」(替代 dsh-context)。

  • 逐轮徽章:每个 assistant 动作后面跟一枚金额徽章,点开看 input / cacheRead / cacheWrite / output 四个 token 桶各花了多少
  • 底部会话累计:状态栏一枚药丸显示本会话累计花费;设了预算后显示 花费 / 预算 与进度条,超支转红
  • 币种 CNY(默认)/ USD 可切:CNY 优先用厂商官方人民币行,缺省按汇率折算并标 fx
  • DeepSeek 峰谷分时计价:历史金额按请求发生时刻落档,不按「现在」重定价
  • 用量总览:跨会话仪表盘(KPI、构成、环形图、趋势、模型花费榜、7 日双指标、周对齐热力图)、会话「上下文」页签、/context 命令弹窗、右侧栏 Context 页签、Agent 家族卡(上下文页内)、逐请求浏览器(筛选 / 排序 / CSV / 分页)
  • 订阅额度 + 到期倒计时:侧栏脚「用量总览」是一条两行卡片——第一行标题右侧是「剩 12 天」倒计时(取最长额度窗口的重置时刻,≤7 天转黄、≤3 天转红),第二行是 5 小时 / 周 / 月三条微型计量条;侧栏折叠时收成一枚「54% / 12天」小方块。按会话最新一次请求的供应商自动选源:OpenCode Go 给三档用量窗口,DeepSeek 给账户余额(充值 / 赠送拆项在悬浮明细里)。仪表盘磁贴主数字是最紧那档、副行是倒计时。Host 侧读密钥、按源 5 分钟缓存,页面拿不到密钥
  • 费用偏好、预算、显隐开关全在插件自有设置页,localStorage 本地持久化
逐轮徽章会话累计与预算
badgedashboard
上下文页签设置页
context tabsettings
订阅余额(侧栏脚 + 仪表盘磁贴)
subscription balance

更多截图见 docs/shots/。

安装

插件以 link: 方式挂进 DSH profile(改完源码重启即生效,无需发版):

git clone https://github.com/yib0601/dsh-turn-cost.git
cd dsh-turn-cost
dsh plugin --profile web add "link:$PWD"

装完重启 dsh web。package.json 里的 dsh.compatibility.dshReleases 声明了已适配的 DSH 版本(0.2.2-rc.2 / rc.3)。

结构

文件角色
index.jsHost 入口:注册 3 个 tc* session 投影(timeline / headers / activity)
host/schema.js、host/fold.js、host/projections.jsHost 侧折叠:token 桶、峰谷分档、命令 / 文件 / 工具调用流水(纯 Node,防御式)
client.jsClient 入口:官方价目表与算价纯函数、本地偏好 store、徽章 / 药丸、槽位注册
client.context.js懒加载 chunk:仪表盘、上下文页签(含 Agent 家族卡)、/context 弹窗
locale/{zh,en}.json两个 locale 命名空间 turnCost / tcContext
contracts/modules.yaml模块契约(负责 / 不负责 / 对外暴露)
test/node --test test/,价目表与 Host 折叠的纯函数测试

设计取舍、数据契约(读哪些投影字段、封顶多少条)见 docs/ARCHITECTURE.md;价目表与峰谷规则见 docs/PRICING.md;功能细节见 docs/DETAIL.md。

测试

node --test test/

边界

只用官方价目表(不采信 models.dev 之类第三方价格);只换算 DSH 已经折叠好的 token 用量,不重算、不改写会话日志、不 append 任何 session 事件;不统计联网搜索 / OCR 等按次计费项;上下文浏览器里的「请求内容」只渲染页面内存中的聊天快照,关页即消失。

Badge

Listed here? Link back with this badge — paste the snippet into your repository README.

Listed on DSH Plugin badge
[![Listed on DSH Plugin](https://dsh-plugin.com/badges/listed.svg)](https://dsh-plugin.com/plugins/yib0601/dsh-turn-cost)