Open sessions continue using a third-party ANTHROPIC_BASE_URL — Claude Code
Quick fix
Set legacy ANTHROPIC_* keys to empty strings in the official provider configuration's env, then switch back to the official provider.
Symptom
Section titled “Symptom”开着的会话继续使用第三方的 `ANTHROPIC_BASE_URL`、`ANTHROPIC_AUTH_TOKEN` 和模型映射,直到重启会话。Open sessions continue using the third-party `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, and model mapping until the session is restarted.
Claude Code hot-loads added or changed env values in settings, but deleting keys from settings does not remove old environment variables retained by the running process. When switching back to official Claude, third-party keys such as `ANTHROPIC_BASE_URL` and `ANTHROPIC_AUTH_TOKEN` are deleted, so the current session still uses their old values.
Verified in a macOS session of Claude Code 2.1.286: changing these keys to empty strings returns the next request to official OAuth immediately; deleting them still sends requests to the third-party address.
Edit the official Claude provider's own configuration, not the general configuration.
In the official provider's `env`, set the Anthropic environment variables used by the previous third-party provider to empty strings.
settings.json "ANTHROPIC_BASE_URL": "","ANTHROPIC_AUTH_TOKEN": "","ANTHROPIC_MODEL": "","ANTHROPIC_DEFAULT_OPUS_MODEL": "","ANTHROPIC_DEFAULT_SONNET_MODEL": "","ANTHROPIC_DEFAULT_HAIKU_MODEL": ""After switching back to official Claude, continue sending messages in the existing Claude Code session. The empty strings are applied through live settings and return the session to the official provider.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
(No FAQ yet)
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.