Skip to content

Gemini: 无效令牌 after enabling the local proxy

Quick fix

Temporarily disable the cc-switch local proxy. Users confirmed Gemini works with it disabled; no verified fix is documented with the proxy enabled.

Error output
[bug] gemini开启本地代理后对话说无效令牌
English translation

[bug] gemini reports an invalid token during conversation after enabling the local proxy

The report concerns Gemini accessing third-party services through the cc-switch local proxy: it reports an invalid token with the proxy enabled and works with it disabled. Some users explicitly used newapi as a relay, and one specified an official AI Studio key upstream. Another user reported that the test passed but the CLI still failed.

The root cause remains unconfirmed. One user relayed an analysis suggesting that Gemini requests were routed to the "codex" group instead of the "gemini" group. Another suspected that the proxy modified the token sent upstream. Neither explanation was confirmed by the maintainer. Although the issue is closed, the thread records neither a fixed version nor a verified fix with the proxy enabled.

  1. Temporarily disable the cc-switch local proxy, then try a Gemini conversation again. The reporter and several commenters confirmed that it works with the proxy disabled. This is a user-verified workaround.

  2. If you need to keep the local proxy enabled, the thread provides no verified solution. Follow the discussion in issue #581, and do not treat the routing or token-modification theories as confirmed root causes.

ToolGemini CLI
Version0.23(报告中的受影响 Gemini 版本)
PlatformsUnknown

This page is distilled from 1 real issues

Was this a third-party API or an official login?
Users reported using third-party services. Some commenters explicitly used newapi as a relay; one distributed access to an official AI Studio key through newapi. The thread does not confirm that direct official login is affected.
Did something go wrong during forwarding?
This remains unconfirmed. Users suggested incorrect request grouping or token modification by the proxy, but the maintainer did not confirm these explanations. The current user-verified workaround is to disable the local proxy.

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.