Choose or pin the model for a session
cli flags & headless
// what it does
--model takes an alias (sonnet, opus) or a full ID (claude-sonnet-5) and sets the model for the session; the in-session /model command switches and saves it as default. --fallback-model sonnet,haiku enables automatic fallback when the primary model is overloaded, and --effort low|medium|high|max trades speed for depth of reasoning.
// shell
$ claude --model sonnet$ claude --model claude-sonnet-5 --effort high$ claude -p "review this" --fallback-model sonnet,haiku// gotcha
Aliases like sonnet and opus always resolve to the current generation, so a script pinned to "opus" quietly moves to the newest Opus on upgrade. Pin a full model ID when you need reproducible behavior across releases.