dsh-zhipu-codingbar:在 DSH Web 会话头部显示智谱 GLM Coding Plan 额度

前言

在 DSH 的插件化思路里,会话状态栏也可以作为一个 Web 客户端插件接入。dsh-zhipu-codingbar 针对智谱 GLM Coding Plan,把额度信息放到 DSH Web 会话头部,减少手动查询额度的操作。

这是什么

dsh-zhipu-codingbar 是一个 DSH Web 插件,由 cesarX-AI 维护,许可证为 MIT。它的数据源只保留智谱,客户端平台为 web,注入 slotstheme

核心功能

  • 显示智谱 Coding Plan 的 5 小时 / 每周 / MCP 工具额度、剩余百分比、重置时间、倒计时。
  • 剩余低于 20% 时变黄,低于 5% 时变红。
  • 在会话头部显示窄条,点击后在胶囊下方展开详情卡。
  • 右侧边栏打开时,详情卡保持宽度并左移,避免被挡住。
  • 支持按 refreshMs 轮询智谱额度,默认 60000 毫秒。

安装与启用

先安装插件:

dsh plugin --profile web add github:cesarX-AI/dsh-zhipu-codingbar --config.minimumReleaseAge=0

然后重启 dsh web

确认插件已挂到配置层:

dsh --profile web --dump-config | grep -A20 zhipu-codingbar

如果要做本地开发,先克隆仓库,再用路径安装:

git clone https://github.com/cesarX-AI/dsh-zhipu-codingbar.git
dsh plugin --profile web add ./dsh-zhipu-codingbar --config.minimumReleaseAge=0

本地改源码后,只需重启 dsh web

典型用法

在 profile 的 cordis.patch.yml 中插入 id: zhipu-codingbar 行,并可配置 config.refreshMs

覆盖示例:

- id: zhipu-codingbar
  config:
    refreshMs: 30000

后一层 patch 会整行替换 config,不会深合并;覆盖时要把需要保留的键一起写上。schema 会补未提供的默认值。

配置与凭据

常用配置项:

  • refreshMs:智谱额度轮询间隔,默认 60000 毫秒。
  • zaiApiKey:可选;空则读 ZAI_CODING_CN_API_KEY~/.dsh/.credentials.yaml

智谱额度接口为:

open.bigmodel.cn/api/monitor/usage/quota/limit

使用 ZAI_CODING_CN_API_KEY。密钥只在服务端使用,路由只返回派生数字。

适用场景与注意

适合在 DSH Web 中使用智谱 GLM Coding Plan、希望直接在会话界面看到额度的开发者。

注意以下几点:

  • 插件以当前 dsh 进程权限运行,安装前应检查源码与许可证。
  • 数据源只保留智谱,不适用于其他模型额度。
  • 覆盖 config 时是整行替换,不是深合并。

相关链接

GitHub 仓库:

https://github.com/cesarX-AI/dsh-zhipu-codingbar

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye