bluechips-zhao/dsh-receipt1

dsh-receipt

会话消费小票:按模型展示每个对话的 token 用量、调用次数、耗时与费用(receipt-style per-conversation usage and cost)

包名
dsh-receipt
版本
0.1.0
许可证
MIT
最近更新
2026年8月24日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:bluechips-zhao/dsh-receipt

配置(定价)

插件默认只内置 DeepSeek 官方长期公开的经典模型价格,其余模型显示"未计价"、 费用记 0。请按你的实际账单配置价格:在 profile 的 cordis.patch.yml 里对 dsh-receipt 行覆盖 config(整段替换):


# 路径经环境变量配置,见 scripts/gui-check.mjs 顶部注释)
$env:RECEIPT_PLAYWRIGHT = '/node_modules/.pnpm/playwright@/node_modules/playwright/index.js'
$env:RECEIPT_CHROMIUM    = ''
node scripts/gui-check.mjs

# 确认配置层已入组合
pnpm dsh --profile web --dump-config | findstr dsh-receipt

实现说明

  • host 半:src/projection.tsreceipt 投影单元——纯同步折叠,state 为纯 JSON(可持久化缓存),view 按注册时捕获的定价表现算费用;替换语义与 tokenUsage 一致(同 step 的 chunk 采样 → 消息终值,整步替换不重复计数)。
  • client 半:conversation.session.header.actions 的"小票"按钮 + shell.overlay 的小票弹层;打开状态经插件内模块级 store 协调, 数据读 useSessions 行上的 projectionValues.receipt(实时帧驱动)。
  • 依赖全部走 peer / profile fallback($DSH_HOME/profiles/node_modules), 不复制 Cordis / React / schemastery 运行时身份。