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.
Symptom
Section titled “Symptom”输出ANTHROPIC_BASE_URL的值为什么是空的?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.
Do not use `echo $ANTHROPIC_BASE_URL` to determine the current Claude Code configuration; an empty value is normal.
Check `~/.claude/settings.json` directly to confirm the Claude Code configuration written by CC Switch.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 1 real issues
- 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.
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.