ERR_BAD_REQUEST api.anthropic.com Claude Code
Quick fix
Turn on "skip the first-install confirmation" in cc-switch and clear the conflicting environment variables to resolve the Claude Code ERR_BAD_REQUEST.
Symptom
Section titled “Symptom”Unable to connect to Anthropic services. Failed to connect to api.anthropic.com: ERR_BAD_REQUEST.Configuring cc-switch to run Claude Code on Windows, a request to api.anthropic.com can error with ERR_BAD_REQUEST because the first-install confirmation flow intercepts it, or because of leftover environment variables (ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL). Maintainers note that the latest cc-switch resolved this by adding a "skip the first-install confirmation" feature.
Update cc-switch to the latest version for the built-in fix.
In the cc-switch interface, find and turn on the "skip the first-install confirmation" option.
Check and unset the ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL system environment variables to prevent a configuration conflict.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 2 real issues
- Is this error caused by my using a relay, or by the official Claude?
- The error is usually unrelated to relay or official API — it comes from the cc-switch first-install confirmation interception or a local environment variable conflict. Follow the steps above to turn on skip-confirmation and clear the environment variables.
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.