Missing API key · Run /login - Claude Code
Quick fix
Clear the conflicting ANTHROPIC_BASE_URL environment variable, or upgrade CC Switch to use its built-in environment variable conflict detection.
Symptom
Section titled “Symptom”Missing API key · Run /loginWhen the ANTHROPIC_BASE_URL environment variable exists in the system (e.g., set by CCR proxy tools or manually configured in WSL), it takes precedence over configurations in ~/.claude/settings.json. This causes Claude Code to ignore vendor configurations written by CC Switch, resulting in missing API keys or prompts to log in again. The new version of CC Switch includes conflict environment variable detection to resolve this issue.
Upgrade CC Switch to the latest version to use the new conflict environment variable detection feature for automatic configuration conflict resolution.
Check and clear the ANTHROPIC_BASE_URL environment variable forcibly set by other tools (such as CCR) to ensure Claude Code can correctly read ~/.claude/settings.json.
If using WSL, it is recommended to run CC Switch on the Windows host and manually configure environment variables in WSL to point to the host proxy.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- What should I do if CCR and CC Switch conflict causes continuous login prompts?
- CCR sets the ANTHROPIC_BASE_URL environment variable, which takes precedence over ~/.claude/settings.json written by CC Switch. Clear this environment variable or upgrade CC Switch to use the conflict detection feature.
- How to keep the CC Switch proxy running in the background in WSL Ubuntu?
- CC Switch does not currently natively support a pure background service mode. It is recommended to run CC Switch on the Windows host, then configure ANTHROPIC_BASE_URL in WSL to point to the proxy port on the Windows host IP.
- Will the universal configuration extraction feature automatically filter ANTHROPIC_BASE_URL?
- Yes, the code automatically filters supplier-specific variables such as ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN, preventing them from being incorrectly stored in the universal configuration.
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.