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,注入 slots 和 theme。

核心功能

  • 顯示智譜 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

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

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

小夜