Coding Plan套餐用量怎么查询?GLM Coding Plan
Quick fix
在 cc-switch 用量查询中填写浏览器请求里的 URL 和 Authorization,并按示例解析限额百分比。
Symptom
Section titled “Symptom”尝试了好久,没有成功,给个教程呗,怎么接入查询的?该报告询问如何为 GLM Coding Plan 接入套餐用量查询。评论中提供了一个参考配置:请求 `https://api.z.ai/api/monitor/usage/quota/limit`,并在请求头中携带 `Authorization`;解析器从响应的 `data.limits` 中查找 `type` 为 `TOKENS_LIMIT` 的项目,并用其 `percentage` 计算剩余百分比。
该配置由社区用户提供,原帖没有说明是否已由提问者验证成功;issue 已关闭不等同于已确认修复。
从浏览器中查找 GLM Coding Plan 用量请求的 `url` 和 `authorization`,并填入 cc-switch 的用量查询配置。
// 浏览器请求中提取的用量查询配置({request: {url: "https://api.z.ai/api/monitor/usage/quota/limit",method: "GET",headers: {Accept: "application/json, text/plain, */*","User-Agent": "cc-switch/1.0",Authorization: "Bearer eyJhbGciOixxxxx",},},extractor: function (response) {var limits = response && response.data && response.data.limits;var percentage = 0;if (limits) {for (var i = 0; i < limits.length; i++) {if (limits[i].type === "TOKENS_LIMIT" &&limits[i].percentage !== undefined) {percentage = limits[i].percentage;break;}}}return {isValid: response && response.success ? true : false,remaining: (100-percentage),unit: "%",};},});使用解析器读取 `data.limits` 中 `type` 为 `TOKENS_LIMIT` 的 `percentage`,并以 `100-percentage` 作为剩余用量百分比。
该方案仅有社区参考配置,原帖未记录提问者的验证结果;如仍无法接入,请继续跟进源 issue。
Affected Versions
Section titled “Affected Versions”Tool未知
Version未知
Platforms未知
Source Issues
Section titled “Source Issues”本页汇总自 1 个真实 issue
- 怎么接入查询的?
- 参考回复建议从浏览器请求中找到 `url` 和 `authorization`,并使用示例请求及解析器配置。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。