<h1 align="center">dsh-zhipu-coding-plan</h1>
<p align="center"> <strong>让智谱 GLM Coding Plan 的额度一目了然。</strong> </p>
<p align="center"> 在 DSH Web 中直接查看 Coding Plan 的 Token 窗口、MCP 工具额度与模型 / 工具用量。 </p>
<p align="center"> <a href="https://www.npmjs.com/package/dsh-zhipu-coding-plan"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-zhipu-coding-plan?style=flat-square&logo=npm&logoColor=white&color=cb3837"></a> <a href="https://github.com/tsja2001/dsh-zhipu-coding-plan/actions/workflows/ci.yml"><img alt="CI status" src="https://img.shields.io/github/actions/workflow/status/tsja2001/dsh-zhipu-coding-plan/ci.yml?branch=main&style=flat-square&logo=githubactions&logoColor=white&label=CI"></a> <a href="./LICENSE"><img alt="MIT license" src="https://img.shields.io/github/license/tsja2001/dsh-zhipu-coding-plan?style=flat-square&color=22c55e"></a> <a href="https://nodejs.org/"><img alt="Node.js 22.19+" src="https://img.shields.io/badge/Node.js-22.19%2B-339933?style=flat-square&logo=nodedotjs&logoColor=white"></a> <a href="https://github.com/topics/dsh-plugin"><img alt="DSH plugin" src="https://img.shields.io/badge/DSH-plugin-4f6ef7?style=flat-square"></a> </p>
<p align="center"> <strong>简体中文</strong> · <a href="README.en.md">English</a> </p>
---
<p align="center"> <a href="./assets/quota-tab.png"><img src="./assets/quota-tab.png" alt="dsh-zhipu-coding-plan 额度页签" width="100%"></a> </p>
<p align="center"><sub>无需离开编码会话,即可掌握 Coding Plan 还剩多少额度。</sub></p>
核心能力
| 能力 | 说明 | |
|---|---|---|
| ⏱️ | Token 窗口 | 5 小时 / 每周 Token 额度进度与重置倒计时,高占用自动变色提醒。 |
| 🔧 | MCP 工具额度 | 本月工具额度已用 / 总量 / 剩余,含联网搜索、网页读取、Zread 等分项明细。 |
| 🤖 | 模型用量 | 近 24 小时 / 7 天的调用次数、Token 总量与按模型占比。 |
| 🔑 | Key 页内配置 | 面板里直接保存 API Key,保存前自动校验;也可走 ZHIPU_API_KEY 环境变量。 |
| 🛡️ | 错误可读 | Key 无效、限流、断网等分类提示,明细接口异常不影响额度展示。 |
快速开始
从 npm 安装(推荐)
dsh plugin --profile web add dsh-zhipu-coding-plan> [!IMPORTANT] > 安装完成后请重启 DSH Web。随后 额度 / Quota 选项卡会出现在对话、轨迹和统计选项卡旁边。首次打开可在面板中直接保存智谱 API Key。
<details> <summary><strong>从 GitHub 安装或卸载</strong></summary>
# 从 GitHub 安装
dsh plugin --profile web add github:tsja2001/dsh-zhipu-coding-plan
# 卸载
dsh plugin --profile web remove dsh-zhipu-coding-plan</details>
你会看到什么
额度窗口
- 5 小时 / 每周 Token:已用百分比进度条,≥80% 转警示色,≥95% 转错误色,并显示窗口重置倒计时。
- 本月 MCP 工具:已用 / 总量 / 剩余次数,附分工具用量明细。
用量明细
- 模型用量:近 24 小时 / 7 天可切换;调用次数、Token 总量、时序柱状图与按模型占比排行。
- 工具用量:同一时间窗内联网搜索、网页读取、Zread、搜索 MCP 的调用次数。
API Key 与隐私
> [!NOTE] > Key 只保存在本机 DSH 凭据存储(~/.dsh/.credentials.yaml)或环境变量中,面板永不显示 Key 值。额度查询直连智谱官方监控接口(open.bigmodel.cn),无第三方中转、无遥测。
- 解析优先级:启动环境
ZHIPU_API_KEY→ DSH 凭据存储 → 启动目录.env。 - 每次查询重新解析,换 Key 无需重启。
- 仅支持个人版套餐;其他平台的 Key(如 DeepSeek)会被明确提示为无效,不会误报数据。
兼容性
- 需要可以正常运行的 DSH Web。
- 需要 Node.js
^22.19.0或>=24.0.0。 - 数据来自智谱监控接口,Token 窗口仅提供百分比(接口不返回绝对值),面板如实呈现。
License
[MIT](LICENSE) © tsja2001