Usage query must be a same-origin request - cc-switch
Quick fix
Switch to the generic or custom template in cc-switch and put the usage query URL straight into the request address, bypassing the same-origin restriction.
Symptom
Section titled “Symptom”3.16.3升级后提示必须要同源请求After upgrading to 3.16.3 it says the request must be same-origin
In cc-switch v3.16.3, some built-in templates added a validation requiring the API request address and the usage query address to be same-origin (the same domain). Since the API endpoint and the usage query endpoint of most third-party relay services are usually on different domains, usage queries fail after upgrading. The cluster also holds reports of enormous token consumption and spiking bills when using a relay reverse proxy (Codex or GPT models): cc-switch converts point-to-point protocol-to-protocol internally, which breaks the signature-based context caching Codex relies on. That conversion caching problem is still being addressed with new caching capability.
On the cc-switch config page, do not use the restricted provider-specific template.
Select 通用模板 (generic template) or 自定义模版 (custom template).
In the request address field, enter your usage query request URL directly.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 4 real issues
- Can claude code use codex subscription models?
- It can — a gateway tool like tingly-box can adapt and convert it. I think newer versions of cc-switch have added some support too.
- Is this fixed in the new version? I do not dare upgrade lightly, since if it stops working it is hard to roll back.
- There is a way around it: pick the generic template and put the query request url in the request address. Or use the custom template, which has no such restriction.
- Token consumption is enormous using a codex auth reverse proxy in claude code — one hello takes 24% of the context. Is token consumption normal for everyone after connecting codex?
- That is because cc switch converts internally point-to-point, protocol to protocol, in a simple way. codex uses signature as the identifier for keeping context, so a straight conversion inevitably keeps losing the cache effect. The usage problem is still being worked on (it needs 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.