[BUG] Claude Code attempts to call api.anthropic.com ignoring our local ANTHROPIC_BASE_URL when hasCompletedOnboarding has not been set.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
We are using LiteLLM and a locally installed Claude Code binary.
We noticed that new users are now getting the following error when they try to run claude code.
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUEST
Please check your internet connection and network settings.
Note: Claude Code might not be available in your country. Check supported countries at https://anthropic.com/supported-countries
api.anthropic.com is blocked by our proxy which is not an issue because our ANTHROPIC_BASE_URL points to a local LiteLLM. But these users cannot continue until we manually add "hasCompletedOnboarding": true to their ~/claude.json.
Reaching out to the anthropic API should not be a requirement for starting Claude Code. At some point CC set "hasCompletedOnboarding": true automatically when users were using LiteLLM or it checked the user's key against the correct ANTHROPIC_BASE_URL.
This seems to be a regression that happened in the past month or so. I am not sure when.
What Should Happen?
When users start CC for the first time the API key check should use the ANTHROPIC_BASE_URL and not api.anthropic.com
Error Messages/Logs
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUEST
Please check your internet connection and network settings.
Note: Claude Code might not be available in your country. Check supported countries at https://anthropic.com/supported-countries
Steps to Reproduce
remove "hasCompletedOnboarding": true from ~/claude.json and start up claude code with an ANTHROPIC_BASE_URL that is not api.anthropic.com.
Claude code will try to connect to api.anthropic.com.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.47 (Claude Code)
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
i tried 2.1.22 and it was still broken then.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗