Usage statistics missing or the query fails - cc-switch
Quick fix
Turn the usage statistics toggle on and check the provider script and protocol limits. Official statistics need Tool Search enabled.
Symptom
Section titled “Symptom”测试失败: base_url 必须使用 HTTPS 协议(localhost 除外)Test failed: base_url must use the HTTPS protocol (except for localhost)
Reports in this cluster centre on cc-switch's usage query / usage statistics feature: statistics missing after an upgrade, a failing test script, odd quota fields, or empty statistics. The reasons differ. In some versions official usage statistics became opt-in, or need Tool Search enabled before anything shows. A custom provider's usage query depends on the request URL you configured, the fields the extractor returns, HTTPS and private-IP restrictions, and whether the provider endpoint works at all. There are also problems with the statistics range, model mapping, and session directory detection. A maintainer noted cc-switch usage statistics still carry a fair number of bugs and that the provider's own data should be treated as authoritative.
If usage statistics are missing from the navigation menu after an upgrade, open the toggle inside the 用量查询 (usage query) button first and confirm official usage statistics are switched on manually.
If 设置 - 关于 - 用量信息 (Settings > About > Usage info) shows 0, tick the Tool Search option and check usage info again.
If the 测试 (test) and 配置用量查询 (configure usage query) buttons are greyed out, delete the provider and add it again so it is not misdetected as an official provider.
If the test script says base_url must use HTTPS, change base_url to HTTPS. localhost is exempt; non-localhost HTTP addresses are blocked.
For a failing Novita AI usage query, do not use the default https://api.novita.ai/v3/user/balance — switch to the working balance detail endpoint.
cc-switch 供应商用量查询脚本(Novita AI) ({request: {url: "https://api.novita.ai/openapi/v1/billing/balance/detail",method: "GET",headers: {Authorization: "Bearer {{apiKey}}","Content-Type": "application/json",Accept: "application/json","User-Agent": "cc-switch/1.0"}},extractor: function (response) {var raw = response.availableBalance;var units = Number(raw);if (raw === undefined || raw === null || !isFinite(units)) {return {isValid: false,invalidMessage: response.message || "Novita 返回缺少 availableBalance"};}return {isValid: true,planName: "Novita AI",remaining: units / 10000,unit: "USD"};}})If usage statistics still look wrong, switch the range to 7d or 30d, and treat the provider dashboard billing data as authoritative.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 21 real issues
- #605用量查询extra字段没用
- #874使用cc swtich反代后打开claude code 出现409错误
- #887请问一下为什么我用cc swtich连接antigravity一直报429啊
- #1261Usage Query “remaining” always displayed with 2 decimals (e.g., points show .00 ) — request formatting/precision option
- #1503claude code的模型里已经设置了主模型、Sonnet 默认模型为glm-4.7,但是在使用统计里仍然显示glm-5 ← claude-sonnet-4-6
- #2044为什么要限制私有ip地址的用量查询和限制https
- #2124如何支持Claude Code Hub的用量查询接口
- #2203为什么我的测试和配置用量查询功能被禁用了?
- #2546统计用量表格闪烁
- #3084cc官方,CLI一直都能访问,但是这个用量这提示会话已过期
- #3319usage_daily_rollups 始终为空,用量面板无数据
- #3555更新新版 3.16.0之后更新用量查询失败了
- #3649Novita AI 用量查询失败
- #4390更新到3.16.3版本后,统计额度又双叒叕不显示了
- #4815使用统计用量没了
- #4979[Feature] usage 统计支持 Claude Cowork(桌面版)本地会话
- #5239Claude 桌面app调用codex cli处理任务时候,codex的用量是不是不会被计算在内?
- #5396http形式的baseurl无法进行用量统计
- #5497火山Agentplan查询额度失败
- #5708下载window的mis安装包离线升级会导致用量统计清空
- #6238[Bug] quota overflow displayed by ark coding plan 5Hour
- Why did usage statistics disappear after updating?
- In some versions official usage statistics became opt-in — enable it inside the 用量查询 (usage query) button. If usage info reads 0, try ticking the Tool Search option.
- Why are the test and configure-usage-query buttons disabled and greyed out?
- The provider may have been misdetected as an official provider. Adding it again usually restores them.
- Why can an HTTP base_url not do usage statistics?
- The usage query used to restrict private IPs and require HTTPS; a non-localhost base_url has to use HTTPS. A maintainer said the over-strict guard will be removed in a later version.
- The model statistics in cc-switch do not match provider billing. What now?
- A maintainer explained cc-switch usage statistics currently carry a number of bugs — go by the provider's own data.
- Are Claude desktop Cowork sessions counted?
- An issue points out the statistics mainly scan ~/.claude/projects/, and Cowork sessions do not live there, so they probably are not counted. This is a gap awaiting support rather than a bug.
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.