How to check Coding Plan usage? GLM Coding Plan
Quick fix
Enter the URL and Authorization from a browser request in cc-switch usage queries, then parse the quota percentage as shown.
Symptom
Section titled “Symptom”尝试了好久,没有成功,给个教程呗,怎么接入查询的?Tried for a long time without success. Could you provide a tutorial on how to add the query?
This report asks how to add usage queries for GLM Coding Plan. A comment provides a reference configuration: request `https://api.z.ai/api/monitor/usage/quota/limit` with `Authorization`; the parser finds the item in `data.limits` whose `type` is `TOKENS_LIMIT`, then uses its `percentage` to calculate the remaining percentage.
This configuration was provided by a community user. The original post does not state whether the reporter verified it worked; a closed issue does not necessarily mean a confirmed fix.
Find the GLM Coding Plan usage request `url` and `authorization` in your browser, then enter them in cc-switch usage query settings.
// 浏览器请求中提取的用量查询配置({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: "%",};},});Use the parser to read the `percentage` of the item in `data.limits` whose `type` is `TOKENS_LIMIT`, and use `100-percentage` as the remaining usage percentage.
This is only a community reference configuration. The original post does not record whether the reporter verified it; if it still cannot be added, continue following the source issue.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- How do I add the query?
- The reference reply recommends finding `url` and `authorization` in the browser request, then using the example request and parser configuration.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.