Gemini local proxy says invalid token cc-switch
Quick fix
Move the Gemini provider channel from codex back to gemini. With the local proxy enabled, this avoids wrong routing and invalid token errors.
Symptom
Section titled “Symptom”gemini开启本地代理后对话说无效令牌After enabling the local proxy, Gemini chat reports invalid token.
The root cause is not Gemini validating the proxy. It is a cc-switch routing group error: the Gemini provider (ID: xx-5d21-4e8d-xx-xx) distributor was configured under the codex group instead of the gemini group. With the local proxy enabled, Gemini model requests were sent to the codex group, so the token appeared invalid after the wrong path. With the proxy disabled, requests did not use that wrong route and worked normally.
Open cc-switch and go to the Gemini provider channel/distributor configuration.
Move that Gemini provider distributor from the codex group to the gemini group, then save the configuration.
Re-inject routing, enable the local proxy, and run the Gemini CLI test. If it still shows invalid token, verify the third-party relay forwarding path, such as newapi.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- If enabling the local proxy reports invalid token but disabling it works, must the proxy be disabled?
- No. Disabling the proxy only bypasses the wrong route. The root cause is that the channel is in the codex group; move it back to the gemini group.
- Was the token modified while passing through the proxy to upstream?
- Some users suspected this, but analysis shows the core issue is that cc-switch routes Gemini requests to the codex group, not token modification.
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.