dsh-usage-dashboard-plus

by 1HelloMan1

3 用量与计费github收录于 08-21

显示 DeepSeek 余额与今日花费估算,合并外部视觉调用 JSONL 记录,并提供含模型统计、TTFT、缓存率、调用日志、费用估算、筛选与 CSV 导出的会话看板。

Shows DeepSeek balance and estimated daily spend, merges external vision-call JSONL records, and adds a per-session dashboard with model statistics, TTFT, cache rate, call logs, cost estimates, filters, and CSV export.

安装

dsh plugin --profile web add github:1HelloMan1/dsh-usage-dashboard-plus

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗

安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。

README

目录

English | 中文

dsh-usage-dashboard 的增强版(fork),核心新增:外部视觉调用计入统计。为 DeepSeek Harness (dsh) 提供侧边栏底部小部件:显示 DeepSeek API 余额 和 今日花费(估算)。

本仓库也是当前唯一的统计看板维护仓库。原来的 dsh-stats-dashboard 功能已经完整合并到 Plus;不要在同一个 profile 中同时安装两个统计插件。

Plus 新增了什么

  • 统计外部视觉模型调用(如 dsh-vision-fallback 触发的 Mimo V2.5 请求):通过可选的 JSONL 用量日志并入今日花费——原版只统计 DSH 会话日志里的调用。
  • 内置 mimo-v2.5 计价条目(opencode Zen GO 费率),开箱即可估算这些调用的费用(可用 prices 覆盖)。

功能

  • 账户余额:通过 DSH 凭证系统解析 DeepSeek key,查询余额接口(带缓存)。
  • 今日花费(估算):扫描会话日志 + 外部用量日志,按 Token 用量 × 价目表估算。
  • 侧边栏底部小部件:余额 ¥xx · 今日 ¥xx,点击展开详情卡片(调用次数、Token、按模型明细、计价说明)。
  • 峰/谷计价:2026-08-17 起的 DeepSeek 分时段价目表。
  • 完整统计看板:按 provider / model 汇总调用次数、响应耗时、TTFT、吞吐量、输入/输出/缓存 Token、缓存率和费用估算。
  • 调用日志与分析:按会话、provider、model 筛选和搜索,保留最近调用明细,并支持 CSV 导出。
  • Stats 功能已继承:usageDashboard session projection、500 条调用日志上限、全量模型聚合和历史会话重放统计均已包含在 Plus 中。
  • 无需构建:host 半(lib/index.js)+ 浏览器 bundle(lib/client.js),走 dsh.client 机制。

从 dsh-stats-dashboard 迁移

  1. 从 web profile 中移除或停用旧的 dsh-stats-dashboard。
  2. 安装 dsh-usage-dashboard-plus。
  3. 重启 dsh web 并强制刷新设置页。

Plus 会继续读取已有会话日志;不需要迁移历史会话数据,也不需要同时保留旧 Stats 插件。旧仓库仅作为历史来源保留,已经停止独立维护。

安装

dsh plugin --profile web add dsh-usage-dashboard-plus
# 重启 `dsh web`(profile patch 层不支持热加载)

npm 包内置 dsh.bundle 与 cordis.patch.yml,安装命令会自动把 usage-dashboard 插入目标 profile,不需要手工复制插件目录或编辑 patch。

验证:

dsh --profile web --dump-config   # 应出现 usage-dashboard-plus 行

然后强制刷新 GUI(Cmd+Shift+R)——侧边栏底部「设置」旁会出现小部件。

配置

配置在 ~/.dsh/settings.yaml 的 usage-dashboard 命名空间下(热加载):

usage-dashboard:
  apiKeyRef: DEEPSEEK_API_KEY      # 查询余额用的凭证引用
  baseURL: ""                      # 空 → $DEEPSEEK_BASE_URL → api.deepseek.com
  prices:                          # 每模型 CNY / 每 1M tokens(input/cacheRead/output)
    "mimo-v2.5": { input: 2, cacheRead: 0.05, output: 8 }
  priceSchedule: []                # 分时段峰/谷价目表
  balanceCacheMs: 60000
  sessionsRoot: ""                 # 默认 <dsh home>/sessions
  scanWindowMs: 172800000          # 只扫描此时间窗内修改过的会话日志
  externalUsageLog: ""             # 外部模型调用用量日志(JSONL)

外部用量日志(externalUsageLog)

dsh-vision-fallback 等插件在 DSH 会话日志管线之外调用模型时,可向该文件追加 JSONL,每行一条外部调用:

{ "ts": 1755000000000, "model": "mimo-v2.5", "inputTokens": 1200, "outputTokens": 320, "cacheReadTokens": 0, "cacheWriteTokens": 0 }

默认路径:<dsh home>/vision-fallback/usage.jsonl。设为 off 可关闭。

开发

npm test    # 校验 npm 包、dsh.bundle 和 cordis.patch.yml

许可证

MIT —— fork 自 dsh-usage-dashboard(MIT)。

原始 README: https://github.com/1HelloMan1/dsh-usage-dashboard-plus/blob/main/README.zh.md ↗