Skip to content

Model Configuration & Environment Variables

AliasBehavior
defaultClears overrides; recommended model for your account
bestFable 5 if your org has access, else latest Opus
fableClaude Fable 5 — hardest, longest-running tasks
opusLatest Opus (Opus 4.8 on Anthropic API) — complex reasoning
sonnetLatest Sonnet (Sonnet 5) — daily coding default
haikuFast/cheap — simple tasks
sonnet[1m] / opus[1m]1M-token context window variants
opusplanOpus during plan mode, Sonnet for execution

Aliases track the newest version. Pin exact versions with full names (claude-opus-4-8) or ANTHROPIC_DEFAULT_OPUS_MODEL etc.

  • Most capable model; excels at long autonomous sessions, root-cause investigation, verification
  • Not the default — select with /model fable
  • Give it outcomes, not steps; hand it ambiguous problems; skip “remember to test” reminders
  1. /model <alias|name> during session — saves as default for new sessions (s in the picker = this session only). Switching mid-session invalidates the prompt cache; the picker warns.
  2. claude --model <alias|name> at startup (session-only)
  3. ANTHROPIC_MODEL=<alias|name> env var (session-only)
  4. "model": "opus" in settings.json (permanent)

Resumed sessions keep the model they were saved with.

  • /effort low|medium|high — reasoning depth vs speed/cost; inherited by subagents
  • /fast — fast mode (Opus with faster output; billed at a premium). Great for iteration loops, wrong for hard design work
VariablePurpose
ANTHROPIC_MODELModel for this session
ANTHROPIC_DEFAULT_OPUS_MODEL / ..._SONNET_MODEL / ..._HAIKU_MODEL / ..._FABLE_MODELPin what each alias resolves to
CLAUDE_CODE_SUBAGENT_MODELDefault model for subagents
ANTHROPIC_API_KEYAPI-key auth
ANTHROPIC_BASE_URLRoute via LLM gateway (changes where, not which model)
CLAUDE_CONFIG_DIRMove ~/.claude storage elsewhere
CLAUDE_CODE_SKIP_PROMPT_HISTORYDon’t write transcripts
ENABLE_TOOL_SEARCHauto/false — deferred vs upfront MCP tool schemas
CLAUDE_CODE_SUBPROCESS_ENV_SCRUBStrip credentials from subprocesses
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSEnable agent teams (see 32-agent-teams.md)

Set env vars persistently via settings.json:

{
"model": "sonnet",
"env": {
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5",
"ENABLE_TOOL_SEARCH": "auto"
}
}
  • availableModels — allowlist of selectable models (managed settings)
  • enforceAvailableModels — make the “Default” picker row obey the allowlist
  • Org admins (Enterprise) can also disable models / set org default from the admin console
// .claude/settings.json (project, committed)
{
"model": "sonnet"
}
  • Daily work: Sonnet (fast, cheap, excellent at coding)
  • Design sessions: /model opusplan — Opus plans, Sonnet executes
  • Nightly deep bug hunt (routine): fable
  • CI helpers / commit-message generation: haiku via claude -p --model haiku
  • Trick:fable hardest, opus reasons, sonnet ships, haiku sprints.”
  • opusplan = brains plan, hands type.
  • Show: /model picker — Enter saves default, s = this session only.
  • They’ll trip on: switching models mid-task — it wipes the prompt cache (slow + expensive turn).

Learning path:12-settings-system.md · Index · ➡ 14-permissions.md

Written by Fenil Patel