Skip to content

Auth conflict: ANTHROPIC_AUTH_TOKEN conflicts with the API key - cc-switch

Quick fix

Log out of the official Claude login, clear conflicting ANTHROPIC_* variables, set hasCompletedOnboarding to true in ~/.claude.json, and restart the terminal.

Error output
‼Auth conflict: Both a token (ANTHROPIC_AUTH_TOKEN) and an API key (/login managed key) are set. This may lead to
  unexpected behavior.
    • Trying to use ANTHROPIC_AUTH_TOKEN? claude /logout
    • Trying to use /login managed key? Unset the ANTHROPIC_AUTH_TOKEN environment variable.

When cc-switch injects ANTHROPIC_AUTH_TOKEN into Claude Code — for a third-party Anthropic-compatible service such as glm, SiliconFlow, or Volcengine — the auth conflict warning fires if Claude Code still holds an official /login managed key, or if both ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY exist in the system environment or the config. The key then does not apply, model switching does nothing, or requests misbehave.

The cluster also mixes in two related but different phenomena. First, with the cc-switch local proxy on, the config is rewritten to ANTHROPIC_AUTH_TOKEN: "PROXY_MANAGED" and a http://127.0.0.1 address, and /model and status bar plugins may show only the official model name — maintainers explain this is usually a display artefact of the background mapping, and the actual request records are authoritative. Second, after Claude Code triggers WebSearch, the model field on the non-streaming fallback request is not rewritten and upstream returns 400 (1210); that was folded into #3090. Separately, a comment carrying a cc_fix_v3.zip malicious file has been flagged as malware and must not be downloaded or run.

  1. To use the ANTHROPIC_AUTH_TOKEN cc-switch configured, run claude /logout in Claude Code first to sign out of the official managed key.

  2. Check your system environment variables and shell config, and remove conflicting ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY entries so only the set cc-switch currently needs remains.

  3. Open the Claude config file in your home directory, set hasCompletedOnboarding to true, and restart the terminal. Users confirm this clears the conflict warning.

    C:\Users\Administrator\.claude.json
    {
    "hasCompletedOnboarding": true
    }
  4. Confirm the cc-switch provider config writes only fields Claude Code supports — ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, ANTHROPIC_MODEL — and does not also configure an API Key Helper or a duplicate api key field.

    cc-switch provider env 示例
    {
    "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-xxx",
    "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
    "ANTHROPIC_MODEL": "glm-4.6",
    "ANTHROPIC_SMALL_FAST_MODEL": "glm-4.6"
    }
    }
  5. If /model shows only the official model name with the local proxy on while the request log shows forwarding to the target model, that is display behaviour of the proxy mapping. If requests genuinely fail or the model does not exist, try toggling the local proxy button off and on again.

  6. Do not download or run cc_fix_v3.zip / cc_fix_v3.exe from the issue comments. That attachment is flagged as malicious and may steal local API keys. If you already ran it, rotate every related key.

ToolClaude Code
VersionUnknown
PlatformsWindows
I cannot find ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY in my system environment variables — why the conflict?
It may be the Claude Code /login managed key conflicting with the ANTHROPIC_AUTH_TOKEN cc-switch injects, or a false positive in the detection. Run claude /logout first, then delete or reset hasCompletedOnboarding to true in ~/.claude.json.
/model does not show custom models such as glm-5 with the local proxy on. Has the config not applied?
Not necessarily. Maintainers explain the local proxy does model mapping in the background, so the status bar or /model may still show the official model name — go by the proxy request log. If requests genuinely fail, try toggling the local proxy off and on.
Can the model end up believing it is Claude because of the proxy?
Yes. Model identity comes mostly from the Claude built-in system prompt, so even with GLM or another model on the backend, it may answer that it is Claude per that prompt. Identity cannot be set through cc-switch — go by the actual request records.
Can a Codex API key be used directly in Claude Code?
No. A maintainer replied in the issue that the codex API cannot be used directly in Claude Code. If a provider offers both Claude Code and Codex forwarding, you have to buy the matching service and ask the provider.
Is the cc_fix_v3.zip in the comments an official fix script?
No. That attachment is flagged as malicious: it unpacks to a .exe that may read plaintext API keys from ~/.cc-switch/cc-switch.db and ~/.claude/settings.json. Do not download or run it, and report the comment.

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.