显示 GLM Coding Plan 额度:提供 glm_quota 工具、左侧栏面板、常驻侧边栏底部额度条、设置分区与插件页卡片。请求 open.bigmodel.cn 或 api.z.ai 的 /api/monitor/usage/quota/limit,按剩余额度显示(100% 为未使用,0% 为已用尽),覆盖 5 小时与每周 Token 窗口、每月 MCP 额度,并附重置倒计时;上游 CREDIT_LIMIT(unit 3/6)与 TOKENS_LIMIT 两种形状都能解析。API Key 存入 DSH 凭据库,不写入配置文件。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:Mikajin1206/dsh-glm-quota
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
View GLM Coding Plan quota (5-hour window / weekly window / monthly MCP calls) inside DeepSeek Harness — as a glm_quota tool, as a strip at the sidebar foot, as a left-sidebar panel, as a settings page, and as a card on the plugin's own page.
Reference implementation follows the structure of dsh-codex-subscription (manifest + cordis patch insert + host plugin exporting apply/Config + a hand-written client bundle), with zero framework imports:
- the
glm_quotatool is built as a plain literal object (same shapedefineToolproduces), - the API key is resolved through DSH's
credentialsservice (config literal → credential ref → env vars), - HTTP uses global
fetch, - the UI is a hand-written
window.__ModuleLoader__bundle registeringsidebar.footer.action,sidebar.panellist,main,settings.section, andplugins.bundle.config, - data reaches the UI over a host route (
connection.fetch.register) atPOST /api/glm-quota/query. @deepseek-ai/schemastery+@deepseek-ai/cosmokitare ordinarydependencies, installed from the public registry with the package — nothing is vendored into the repository.
Sidebar entry
A sidebar icon only exists if the bundle registers the pair itself:
| Slot | Key | What it draws |
|---|---|---|
sidebar.footer.action |
id = package name |
the quota strip beside the sidebar's Settings button (order 2 here) |
sidebar.panellist |
id = package name |
one row in the panel list (order 20 here) |
main |
key = package name |
the central column for that panel id |
The row glyph is an inline SVG gauge using currentColor, sized by the size prop the sidebar passes. The page reuses the card component with variant: 'page', so the four UI entry points cannot drift apart.
The footer slot hands each action only { wide }. Wide shows a title row and one bar per window, each with its remaining percentage and a countdown to the window's reset (1h 32m后重置); the 56px rail shows a single GLM 74% label for whichever window is closest to running out. Because the footer is mounted all the time, the strip polls every 5 minutes rather than refreshing only when opened, and clicking it calls ctx.layout.selectPanel('dsh-glm-quota').
The strip's reset label is a countdown, not a timestamp: the sidebar is too narrow for a locale-formatted date, and "how long until it recovers" is the figure worth watching. See formatResetIn in lib/client.js.
Credentials are asynchronous
Credentials.resolve/describe return promises of record objects, never bare strings:
const record = await credentials.resolve('GLM_API_KEY') // => { value, source } | undefined
Reading it without await silently yields undefined, which is what made "API key saved." appear next to "No API key configured." in 0.2.0. The card also now confirms the write by re-reading status before reporting success, so a failed read-back surfaces as an error instead of a false positive.
Install
DSH installs plugins from a market index, an npm package, a git repository, or a local directory/tarball.
From this repository:
# DSH: plugin_manager install_bundle with the absolute package directory,
# or from a packed tarball produced by `npm pack`.
The bundle declares dsh.bundle.patch (which inserts the glm-quota entry) and
engines.dsh (>=0.2.2-rc.1 <0.3.0-0), so the harness can check compatibility
before activating it.
After installing, the plugin appears in four places:
| Where | What |
|---|---|
| Sidebar foot | the quota strip (wide) or the GLM n% label (56px rail) |
| Sidebar panel list | the gauge icon, opening the full quota page |
| Settings | a GLM Quota section |
| Plugins → GLM Quota | the plugin page card |
Upstream
GET {base}/api/monitor/usage/quota/limit, header Authorization: <raw token>:
cn→https://open.bigmodel.cnglobal→https://api.z.ai
Response: { code, msg, success, data: { level, limits: [...] } }.
limits carries the two usage windows in one of two shapes, and both are handled:
| Shape | 5-hour window | Weekly window |
|---|---|---|
TOKENS_LIMIT × 2 |
first after sorting by nextResetTime |
second |
CREDIT_LIMIT × 2 |
unit: 3 |
unit: 6 |
lite plans answer with CREDIT_LIMIT, which is why a parser that only knew TOKENS_LIMIT reported an empty quota. A TIME_LIMIT row is the monthly MCP allowance (usage total, currentValue used, remaining) and applies under either shape. nextResetTime is epoch milliseconds upstream and ISO in the plugin's output.
Remaining, not consumed
Upstream's percentage is the share already used — 100 means the window is exhausted. Every surface here reports the opposite: remainingPercentage, where 100 is a full allowance and 0 is nothing left. The conversion happens once, in normalizeQuota/makeWindow (lib/index.js), so no renderer has to remember the direction. Bar tones follow the same sense: a nearly empty bar is the warning, not a nearly full one.
Layout
lib/index.js host plugin (tool + config + /api/glm-quota/query route)
lib/client.js client bundle (sidebar strip + panel + settings page + plugins-page card)
cordis.patch.yml bundle patch (insert id: glm-quota)
locale/*.json plugin meta (en/zh)
docs/DETAIL*.md plugin detail page text
icon-glm-quota.svg plugin icon
License
MIT
链接
同类插件
bowenliang123/dsh-context★ 5191
DSH 上下文洞察面板:Context 仪表盘 + /context命令 + Context 浏览器,查看 Context的分类组成、内容详情、演进趋势、压缩/注入事件、统计等一站式 Context 全生命周期管理。
Han-1413141/dsh-cost-meter★ 705
会话与当日 API 费用统计、预算图框(已用%)、官方余额、历史看板,支持峰谷计价与官方价格一键同步。
wssfk12138/dsh-damage-pulse★ 290
在 DSH Web 界面追踪 DeepSeek Token 用量、单次与会话费用及账户余额,并显示缓存感知的扣费动画。
zh667/TokenLedger★ 205
侧边栏用量面板:把 Token 归属到实际服务该请求的中转站,站点从已有的 provider 配置中读出,无需额外配置;含今日/本月/累计三窗口、按站点与模型下钻、一年活跃度热力图,以及 New API / Sub2API / DeepSeek 余额。
Ychris12138/dsh-usage-stats★ 190
多供应商用量看板:按供应商/模型统计 Token 与日期下钻,统一展示账户余额,并追踪 OpenCode Go / Z.ai 订阅额度。
Mt-Youya/dsh-plugins#sessions-insight★ 166
按工作目录浏览 Claude Code、DSH 和 Codex 会话日志,查看每轮上下文构成、token 用量、压缩点和费用估算。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。