Claude Code Configuration
Claude Code is Anthropic's terminal programming tool for developers. It can read the current project, help you explain code, modify files, run check commands, and can also work with the Claude model to handle more complex development tasks.
What this tool is and what it is used for
Where to look for configuration first
| Location | Who it is suitable for | Description |
|---|---|---|
~/. claude/settings.json | People who want to save the configuration permanently | Write the environment variables related to Claude Code into the configuration file, it's easier to troubleshoot. |
| Current terminal environment variables | People who just want to test temporarily | It usually will not continue to take effect after the terminal is closed. |
| CC Switch | People who manage multiple CLIs at the same time | First configure the Provider on the CC Switch page, then apply it to Claude Code |
How to fill in Key and interface
If using the official Claude, prioritize following the official login or official Key process through Anthropic / Claude Code. If using an AI provider, you must confirm that the provider offers the Claude / Anthropic interface, and do not enter a regular OpenAI compatible address into Claude Code.
{ "env": { "ANTHROPIC_API_KEY": "YOUR_KEY", "ANTHROPIC_BASE_URL": "https://YOUR_PROVIDER_CLAUDE_API_URL", "ANTHROPIC_MODEL": "PROVIDER_SUPPORTED_CLAUDE_MODEL" } } | Setting | Where are you from | Common mistakes |
|---|---|---|
| ANTHROPIC_API_KEY | Claude / Anthropic Key in the provider backend | Do not use the token remark name as the Key |
| ANTHROPIC_BASE_URL | The Claude / Anthropic interface address provided by the provider | Do not copy the OpenAI compatible address |
| ANTHROPIC_MODEL | The Claude model name in the provider model list | Copy the case, hyphens, and version numbers exactly |
How to test after saving
claude "Please reply only: Configuration successful" If you are still using the old configuration, first check whether there is an old Key or old Base URL in the system environment variables. The priority of environment variables may cause the settings you just changed to not take effect.
