401 Unauthorized caused by PROXY_MANAGED in Claude Code
Quick fix
Upgrade to 4.0 or the latest version; use the real API key from the provider configuration for routing.
Symptom
Section titled “Symptom”401 {"error":"Unauthorized"}
Retrying in 4 seconds... (attempt 5/10)When Proxy Takeover is enabled, CC-Switch writes the `PROXY_MANAGED` placeholder credential to `~/.claude/settings.json`. Claude Code sends that value to the proxy; in this issue, the proxy forwarded the placeholder unchanged to an `openai_chat` backend that uses API key authentication, so the backend returned 401. A comment also confirmed that the issue recurs after switching providers. The maintainer said that version 4.0 redesigned routing: the client still uses the local address and placeholder credentials, while forwarding uses the real API key from the provider entry. The maintainer asked the user to verify whether the latest version resolved the issue, but no verification result was received.
Upgrade to 4.0 or the latest version, then enable routing again. The maintainer said this version reworked forwarding credential handling; verify whether the 401 is gone.
If you cannot upgrade yet, the temporary workaround in the report is to manually write the real API key to `~/.claude/settings.json` after enabling Proxy Takeover. Switching providers or using the CC-Switch terminal button changes it back to the placeholder. This writes the key to the client configuration.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- What should I do if the 401 still occurs after updating to 4.0?
- The maintainer asked for the CC-Switch version, reproduction steps, or logs. If the issue persists, reply to that issue or create a new one.
- Why does the 401 return after switching providers?
- A comment confirmed that, with the `openai_chat` format, switching providers causes `PROXY_MANAGED` to be sent again as the API key. The maintainer recommended verifying the new routing behavior in 4.0.
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.