Skip to content

settings.json env not taking effect - Claude Code

Quick fix

Claude Code reads settings.json only at startup. After switching providers, restart Claude Code or set env vars manually.

Error output
After switching providers via cc-switch, the `settings.json` is updated, but Claude Code doesn't reload the `env` config - `/status` still shows the old URL.

Claude Code does not hot-reload the settings.json configuration file. It loads settings.json only once at startup. After switching providers with cc-switch, the config file is updated, but Claude Code still uses the old environment variables, such as `ANTHROPIC_MODEL`.

  1. Restart Claude Code so it reads the updated `settings.json` configuration file at startup.

  2. If it still does not take effect after restart, manually set the environment variables in the terminal, then start Claude Code.

    PowerShell / Terminal
    export ANTHROPIC_MODEL="your-model-name"
  3. As an alternative, use a tool that maintains a local proxy, such as clash-for-ai, so you can switch without modifying the config file each time.

ToolClaude Code
VersionUnknown
PlatformsWindowsmacOS

This page is distilled from 1 real issues

The setting.json file looks correct in the IDE, but the environment variables are empty in PowerShell. Why?
Claude Code does not dynamically read the `env` field from `settings.json` at runtime and inject it into the current terminal environment. It loads it only once at startup.
Is there a way to avoid restarting or manually exporting every time I switch?
Use a tool such as clash-for-ai that switches by maintaining a local proxy. This avoids the hot-reload problem caused by modifying the config file.

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.