Claude Code Per-Project Settings

Configure different Claude models (or LiteLLM backends) per project on the same machine using project-local settings.json.

Why / When to Use

When multiple projects on the same machine need different backends — one project via LiteLLM/GLM proxy, another via direct Anthropic Opus, another via claude.ai subscription — without touching global settings.

Core Concept / Commands

Claude Code reads settings in this priority order (highest wins first):

{project}/.claude/settings.json   ← project-local (wins)
~/.claude/settings.json            ← user-global (fallback)

Create a .claude/ folder inside each project root and place settings.json there.

Key Options / Variants

Project A — LiteLLM / GLM proxy

// /projects/A/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://172.18.0.1:4001",
    "ANTHROPIC_API_KEY": "anything",
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}

Project B — Direct Anthropic Opus (API key)

// /projects/B/.claude/settings.json
{
  "env": {
    "ANTHROPIC_API_KEY": "sk-ant-REAL_KEY_HERE"
  }
}

No ANTHROPIC_BASE_URL override → Claude Code talks to Anthropic directly.

Project C — claude.ai subscription (interactive login)

cd /projects/C
claude /login

Claude Code stores subscription token per-session; run /login once per project directory.

Gotchas

  • env keys in settings.json are only active when Claude Code runs inside that project directory
  • ANTHROPIC_BASE_URL must point to a running LiteLLM/proxy server before Claude Code starts
  • Per-project .claude/ is not committed to Git by default — add to .gitignore if the key is sensitive
  • Running Claude Code from the wrong directory picks up the wrong settings silently

Source

Conversation “Multiple projects with different Claude models” — 2026-05-13