Claude Code Model Configuration
Definition
How model selection works in Claude Code: aliases, the opusplan hybrid strategy, precedence chains, enterprise allowlists, and fallback mechanisms (captured 2026-07-31, HTTP 200).
Key Points
- Aliases are version-sensitive and provider-dependent —
default,best,fable,sonnet,opus,haiku,opusplan,sonnet[1m],opus[1m]; the same alias resolves differently by provider (Anthropic API → Opus 5/Sonnet 5; Bedrock/GCP → Opus 5/Sonnet 4.5; Foundry → Opus 4.6/Sonnet 4.5). “Aliases point to the recommended version for your provider and update over time.” Pin by full name (claude-opus-5) orANTHROPIC_DEFAULT_*_MODEL. opusplan—opusin plan mode,sonnetin execution mode; the plan-mode Opus phase inherits theopuscontext window (auto-upgraded to 1M on eligible tiers; forceopusplan[1m]).- Precedence chain —
/model <alias>(Enter = save default,s= session-only) →claude --model→ANTHROPIC_MODEL→modelsettings field; as of v2.1.153/modelwrites themodelfield to user settings; resumed sessions keep the transcript’s model. - Enterprise governance —
availableModelsallowlist +enforceAvailableModels+model/env pins; “Themodelsetting is an initial selection, not enforcement.” Empty allowlist never locks out Default; keep ≥1 guaranteed-available entry. Org-level restrictions are enforced server-side, separate fromavailableModels. - Two fallback mechanisms — availability-based chains (cap 3, current-turn-only, entries outside the allowlist dropped, no fallback to smaller context during compaction) and content-based safety-classifier fallback for Fable 5/Opus 5 (
switchModelsOnFlag, v2.1.219+).
Implications
Model selection is a token-spend lever: effort levels are explicitly framed as a token/capability tradeoff, and routing cheap models (Haiku) to background work cuts cost. The provider-dependent alias resolution means claims like “opus = Opus 5” are only true on some providers — a source of seeming contradiction to flag in citations. opusplan is the canonical hybrid of expensive-reasoning/cheap-execution, mirroring the plan-gate pattern at model level.
Open Questions
- Heavily version-sensitive: dozens of “Before v2.1.x” gates (alias resolution v2.1.219,
enforceAvailableModelsv2.1.175, org defaults v2.1.196,--effort ultracodev2.1.203); deprecation:ANTHROPIC_SMALL_FAST_MODEL→ANTHROPIC_DEFAULT_HAIKU_MODEL; merge→replace flip of managedavailableModelsat v2.1.175. All claims drift as versions move. - Model names (Opus 5, Sonnet 5, Fable 5) postdate the vault’s model entity pages.
Related
claude-code-environment-variables — ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_*_MODEL, subagent/effort/context env vars
llm-settings-and-parameters — effort levels, extended thinking, context window controls
prompt-caching — DISABLE_PROMPT_CACHING{,_HAIKU,_SONNET,_OPUS,_FABLE} config
claude-code-sessions — model persistence on resume, session-only vs saved /model
token-usage-reduction — effort/model routing as a token-spend lever
claude-code-best-practices — the workflow this configuration supports
claude-code-context-window — 1M-token model gate this doc’s aliases resolve to
Sources
- raw/external/code-claude-com-model-config-815ffab5.md