yuye05/dsh-monitor 预览 preview

yuye05/dsh-monitor

一个 Windows 桌面悬浮小窗:启动 Claude Code / dsh 时自动弹出,实时显示 DeepSeek 开放平台 和 智谱 GLM 平台 的官方用量(余额、今日消费、模型 Tokens、请求数)和本地缓存命中统计。

catalog descriptioncatalog 简介 / catalog description:Windows 桌面悬浮窗,实时显示 DeepSeek 官方用量(余额/今日消费/模型 Tokens/请求数)+ 本地缓存命中统计

Project Overview项目介绍

This is a Windows desktop floating window tool that tracks API usage and costs for DeepSeek and Zhipu GLM platforms, and it can be configured to automatically launch when you start DSH or Claude Code. It uses Playwright to scrape DeepSeek’s official website to get up-to-date official data including account balance, daily consumption, per-model token usage, and total request counts. It also parses local Claude Code session logs to generate 7-day cache hit statistics, and offers three different integration methods to add the auto-launch behavior to DSH or Claude Code’s startup process.

It is built for developers who use both DeepSeek and Zhipu GLM models for development work and are sensitive to API costs. The typical workflow after setup is that when you launch DSH or Claude Code, the floating window will pop up automatically, letting you see at a glance the current balance, daily or monthly consumption, and per-model token usage for both platforms. If you click anywhere outside the window, it collapses into a narrow top bar to save desktop space, and you can click the bar any time to expand it back to full view.

The project is open-sourced under the MIT license, so it is free to use and modify for any purpose. As a personal workflow tool, it has strict environment requirements: you must run Windows 10 or later, and have Python 3.10+, Node.js 18+, Microsoft Edge, and WebView2 runtime installed to run it correctly. On first run, you need to manually log in to DeepSeek (and optionally Zhipu GLM) to save the login session, and all sensitive credentials are excluded from the git repository by default.

这是一个运行在 Windows 系统上的桌面悬浮窗工具,专为监控 DeepSeek 和智谱 GLM 平台的 API 用量与花费开发,支持随 DSH 或 Claude Code 启动自动弹出。它通过 Playwright 抓取 DeepSeek 开放平台官网获取官方的余额、今日消费、模型 Token 用量和请求数数据,还能解析 Claude Code 本地会话日志生成缓存命中统计,提供三种自动触发方式集成到 DSH 或 Claude Code 启动流程。

适合需要同时使用 DeepSeek 和智谱 GLM 大模型做开发,对 API 成本敏感的开发者使用。典型工作流是:启动 DSH 或 Claude Code 后,悬浮窗自动弹出,你可以一眼看到两个平台的当前余额、当日/当月消费以及各模型的 Token 用量。点击窗口外部可将悬浮窗收缩为顶部窄条,需要查看时点击即可展开,不占用多余桌面空间。

本项目遵循 MIT 开源许可,是免费的个人工作流工具,深度绑定特定运行环境,使用前需要满足多项前提。要求系统为 Windows 10 以上,已安装 Python 3.10+、Node.js 18+、Microsoft Edge 和 WebView2 运行时,首次使用需要手动登录 DeepSeek 和(可选)智谱平台抓取会话,所有敏感信息不会上传到代码仓库。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 3 warnings3 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
  • No DSH plugin manifest detected - it may only carry the dsh-plugin topic, so the install method must be confirmed on the spot未检测到 DSH 插件清单:可能只是打了 dsh-plugin 话题,安装方式要现场确认
  • Desktop client: installation downloads an executable - verify the publisher and checksums桌面客户端:安装会下载可执行文件,请核对发布者与校验和
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:yuye05/dsh-monitor

把 yuye05/dsh-monitor 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

DeepSeek Monitor 悬浮窗

一个 Windows 桌面悬浮小窗:启动 Claude Code / dsh 时自动弹出,实时显示 DeepSeek 开放平台 和 智谱 GLM 平台 的官方用量(余额、今日消费、模型 Tokens、请求数)和本地缓存命中统计。

数据以官网为准(Playwright 抓 platform.deepseek.com/usage),本地日志只做模型分解与 7 天图表,避免"本地统计 ≠ 官方"的偏差。GLM 部分官网只能提供余额与月消费(智谱官网无 per-model token 明细),token 用量走本地 jsonl。

示意

⚠️ 定位说明:这是个人工作流工具,不是通用产品——它深度绑定作者自己的环境。clone 前请先确认以下前提都满足,否则核心功能(官方数据)起不来:

  • Windows 10+(依赖系统 WebView2 运行时与已装的 Edge)
  • 使用 Claude Code 且会话日志落在 ~/.claude/projects/*/*.jsonl(本地命中率/7 天图全靠它;不用 Claude Code 的话这些板块显示空)
  • 有 DeepSeek 开放平台账号,且愿意手动登录一次抓取会话(node fetch_official.js --login)
  • (可选,显示 GLM 需) 有 智谱开放平台账号,且愿意登录一次(node fetch_glm.js --login)
  • 本机可运行 @playwright/test(npm install 或全局安装)

创作缘由

DeepSeek V4 系列在 2026-08-17 起大幅涨价并改为峰谷定价——高峰时段费用直接翻倍,跑模型的成本一下子敏感起来。涨价之后,"得盯着点花费"就成了日常。但每次想看余额和用量,都得打开浏览器登录官方平台翻页面——重复几次就烦了。

后来又把 智谱 GLM-5.3-Flash 接入模型池(编码/agent 强、原生多模态、便宜),于是这个悬浮窗也一并把 两个平台 的余额和用量收进来,启动即见,随时知道钱花在哪儿。

功能

  • 🪟 无边框置顶小窗,贴屏幕右上角;拖动顶部空白/标题栏即可移动(.drag-zone 拖拽区,按钮在兄弟节点不被拖拽劫持)
  • 📁 点击外部自动收起:点浮窗之外 → 收成顶部一根 40px 居中窄条(纯色背景、隐藏按钮,仅 logo + 标题 + ▾);点击窄条 → 一键展开回完整界面(不悬停自动展开)
  • 💰 官方余额 / 当日消耗 / 今日 Tokens(DeepSeek)
  • 🔥 智谱 GLM 余额 + 本月消费(GLM 卡片下方独立条)
  • ⚡ 三模型卡片:V4.1 Flash / V4 Pro / GLM-5.3 Flash(DeepSeek 走官网,GLM 走本地 jsonl)
  • 📊 最近 7 天缓存命中明细柱状图
  • 🔄 手动刷新(每次约 8s,headless Edge 抓官网)
  • 🎨 深色「能源仪表舱」主题(可切浅色):深墨底 + 暖金弧环余额表 + 冷青缓存命中 + 等宽数字;标题栏主题按钮深浅切换并记忆(localStorage)
  • 📀 余额弧环:余额外的 260° 弧环 = 今日消耗占预算比例(阈值来自 config 的 today_cost_alert_threshold),越阈值转红

环境要求

依赖 版本 说明
Python 3.10+ pip install -r requirements.txt(pywebview)
Node.js 18+ 官网抓取器用 Playwright
Windows 10+ — pywebview 依赖系统 WebView2 运行时
Microsoft Edge 已装 抓取复用系统 Edge(channel: msedge)

安装

# 1. Python 依赖
pip install -r requirements.txt

# 2. Node 依赖(官网抓取器)
npm install          # 安装 @playwright/test

# 3. 配置文件
cp config.example.json config.json
#    编辑 config.json,填入你的三条路径:
#    node_path         npm 全局 node_modules(@playwright/test 所在)
#    credentials_file  DeepSeek API key 文件
#    claude_projects   Claude Code 会话 jsonl 目录

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-reader 下一个 Next dsh-telemetry-redactor →