It reports 401 in claude - Claude Code
Quick fix
Turn the cc-switch local proxy on to convert the API format, and make sure ANTHROPIC_BASE_URL is injected into the Claude Code process.
Symptom
Section titled “Symptom”到claude 里面提示 401It reports 401 in claude
Configuring an older OpenAI format (DeepSeek-v3, say) and having the cc-switch test pass while Claude Code errors usually means the environment variables did not reach the Claude Code process. Some users also mistake the cc-switch "proxy" for a VPN — that local proxy feature converts an OpenAI-format endpoint into the Anthropic format. Without the local proxy on, or with `ANTHROPIC_BASE_URL` misconfigured, Claude Code cannot recognise the model or returns 401.
Confirm the local proxy is on in cc-switch settings with 接管 Claude (take over Claude) ticked.
If it still does not work when launched from the cc-switch built-in terminal, set `ANTHROPIC_BASE_URL` to the proxy address by hand in a system terminal.
~/.zshrc 或 ~/.bash_profile export ANTHROPIC_BASE_URL="http://127.0.0.1:代理端口"Restart the terminal so the environment variable applies.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Which proxy do I need to turn on?
- There is a local proxy switch in settings, used to convert an OpenAI-format endpoint into the Anthropic format — not a VPN.
- Reaching the DeepSeek API with `http_proxy` set breaks the stream often. What now?
- Configure the system proxy by default, then add a proxy bypass for deepseek in your proxy software.
- Cache hit rates are low using Codex with the DeepSeek API. Is my config wrong?
- That should be a deepseek problem, not a cc-switch problem.
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.