@kongjianguan/dsh-tokstat
dsh usage & performance statistics: settings-panel plugin + TUI (tokens / TTFT / TPS / cost)
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:kongjianguan/dsh-tokstat说明文档
阅读完整 README ↗或使用仓库内辅助脚本(自动写 package.json + 建 node_modules 链接)
node scripts/link-profile.mjs --profile web-dev
卸载:
```bash
dsh plugin --profile web-dev remove @kongjianguan/dsh-tokstat
方式二:Python TUI
git clone https://github.com/kongjianguan/dsh-tokstat.git
cd dsh-tokstat
./run.sh # 自动创建虚拟环境并安装依赖(等价于下方手动步骤)
或手动:
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python main.py
TUI 升级:
git pull
.venv/bin/pip install -r requirements.txt # 依赖有变更时
TUI 卸载:
rm -rf dsh-tokstat # 工具无后台进程、无系统级安装、无写出的数据文件
Quick start
dsh 设置面板插件
dsh plugin --profile web-dev add https://github.com/kongjianguan/dsh-tokstat.git
dsh --profile web-dev --port 3199
## Configuration
全部通过命令行参数与一个 YAML 文件配置,无环境变量依赖:
| 参数 / 文件 | 说明 |
|---|---|
| `--home PATH` | dsh 数据目录(默认 `$DSH_HOME` 或 `~/.dsh`) |
| `--refresh SECONDS` | 轮询刷新间隔(默认 2) |
| `--range all\|today\|7d\|30d` | 初始时间范围(默认 all) |
| `--prices PATH` | 价格表 YAML 路径(默认项目内 `prices.yaml`) |
`prices.yaml` 按**每百万 token** 定价(¥),内置 DeepSeek v4 官方价格,可增删:
```yaml
deepseek-v4-flash:
input: 1.00 # 每百万输入 token
output: 2.00 # 每百万输出 token
cacheRead: 0.20 # 每百万缓存命中 token
模型 ID 自动归一化(去 owner/ 前缀、去 :后缀、@→-、去日期后缀),
deepseek-v4-flash-0731 先精确匹配、再逐级缩短匹配。未定价模型成本显示 -。