Set a Default Model with the ANTHROPIC_MODEL Env Var
If you always reach for the same model, stop passing --model on every command. The ANTHROPIC_MODEL environment variable sets your default so you never have to think about it.
# Add to your .zshrc or .bashrc
export ANTHROPIC_MODEL="claude-opus-4-6"
Now every Claude Code session uses that model automatically:
# No --model flag needed
claude "Refactor the payment service"
claude -p "Write a changelog entry for this diff"
You can still override it for individual commands — the flag always takes precedence over the environment variable:
# Override for a quick, cheap task
claude --model claude-haiku-4-5-20251001 "Rename this variable across the codebase"
# Override for something that needs maximum power
claude --model claude-opus-4-6 "Design the architecture for this new feature"
This is particularly useful if you're testing a newly released model across your daily workflow — update the env var once and every session picks it up automatically. When you're done evaluating, change it back in one place.
# Confirm which model is active
echo $ANTHROPIC_MODEL
Set it in your shell profile once, and never think about it again.
Log in to leave a comment.
The autoUpdatesChannel setting pins Claude Code to a stable release track that skips versions with major regressions.
The language setting makes Claude respond in your preferred language by default, across every session and project.
The attribution setting lets you customize or completely remove Claude's Co-Authored-By trailer from git commits and pull requests.