Usage query requires same-origin requests in cc-switch
Quick fix
In cc-switch, switch to the generic or custom template and enter the usage query URL directly in the request address to bypass the same-origin restriction.
Symptom
Section titled “Symptom”3.16.3升级后提示必须要同源请求After upgrading to 3.16.3, it says that requests must be same-origin.
In cc-switch v3.16.3, some built-in templates added a check requiring the API request address and usage query address to share the same origin (the same domain). Because most third-party proxy services usually host their API and usage query endpoints on different domains, usage queries fail after users upgrade. The issue cluster also reported massive token consumption and soaring costs when using proxy services as reverse proxies (such as for Codex or GPT models). This happens because cc-switch uses simple point-to-point protocol conversion internally, which breaks the context caching that Codex relies on through signature. The upstream project is still developing new caching capabilities to address this protocol conversion cache issue.
On the cc-switch configuration page, do not use a restricted template for a specific provider.
Select the “Generic Template” or “Custom Template.”
Enter your usage query request URL directly in the request address field.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 4 real issues
- Can Claude Code use models from a Codex subscription?
- Yes. Gateway tools such as tingly-box can adapt and convert them. I recall that newer versions of cc-switch also added some support.
- Has this issue been resolved in newer versions? I’m afraid to upgrade because if it doesn’t work afterward, it’s hard to roll back.
- There is a workaround: choose the generic template and enter the query request URL in the request address. You can also use a custom template, which has no such restriction.
- When using a Codex auth reverse proxy with Claude Code, token consumption is massive—a single “hello” uses 24% of the context. Is everyone’s token consumption normal after connecting Codex?
- This happens because cc-switch uses a simple point-to-point protocol conversion internally. Codex uses signature to maintain context; direct conversion inevitably causes cache benefits to be lost repeatedly. The usage issue is still being addressed, and that requires adding a new caching capability.
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.