Skip to content

Why is the value of ANTHROPIC_BASE_URL empty? Claude Code

Quick fix

This is expected behavior: CC Switch does not inject variables into the shell; check the current configuration in ~/.claude/settings.json directly.

Error output
输出ANTHROPIC_BASE_URL的值为什么是空的?
English translation

Why is the output value of ANTHROPIC_BASE_URL empty?

CC Switch does not inject environment variables into the shell; it writes them to `~/.claude/settings.json`. So an empty result from `echo $ANTHROPIC_BASE_URL` in the terminal does not mean Claude Code is not using the currently switched configuration.

Claude Code reads this config file at startup; to confirm the current configuration, check `~/.claude/settings.json`. Later discussion in this issue also notes that the file's write behavior differs between local routing mode and direct connection mode.

  1. Do not use `echo $ANTHROPIC_BASE_URL` to determine the current Claude Code configuration; an empty value is normal.

  2. Check `~/.claude/settings.json` directly to confirm the Claude Code configuration written by CC Switch.

ToolClaude Code
VersionUnknown
PlatformsmacOS
Does this only work for terminals opened from the CC Switch interface? If so, which configuration does a separately opened terminal use?
No. CC Switch does not inject environment variables into the shell; when you run Claude Code in any terminal, Claude Code reads the configuration from `~/.claude/settings.json`.
There is a problem now: permissions were clearly set in the configuration, but they are gone when the terminal opens; I have to exit and re-enter to use them.
The issue does not provide a confirmed solution.

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.