# macOS
-weight: 500;">brew -weight: 500;">install ollama # Linux
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # Windows (via WSL2)
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh
# macOS
-weight: 500;">brew -weight: 500;">install ollama # Linux
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # Windows (via WSL2)
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh
# macOS
-weight: 500;">brew -weight: 500;">install ollama # Linux
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # Windows (via WSL2)
-weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh
ollama serve
ollama serve
ollama serve
# Best overall coding model for local use (35B, needs 24GB+ RAM)
ollama pull qwen3.5:35b # Great MoE option — only 4B active params, runs on 16GB (26B total)
ollama pull gemma4:26b # Smaller but capable (needs 8GB+ RAM)
ollama pull qwen3.5:14b # Budget option — runs on almost anything (needs 4GB+ RAM)
ollama pull qwen3.5:7b
# Best overall coding model for local use (35B, needs 24GB+ RAM)
ollama pull qwen3.5:35b # Great MoE option — only 4B active params, runs on 16GB (26B total)
ollama pull gemma4:26b # Smaller but capable (needs 8GB+ RAM)
ollama pull qwen3.5:14b # Budget option — runs on almost anything (needs 4GB+ RAM)
ollama pull qwen3.5:7b
# Best overall coding model for local use (35B, needs 24GB+ RAM)
ollama pull qwen3.5:35b # Great MoE option — only 4B active params, runs on 16GB (26B total)
ollama pull gemma4:26b # Smaller but capable (needs 8GB+ RAM)
ollama pull qwen3.5:14b # Budget option — runs on almost anything (needs 4GB+ RAM)
ollama pull qwen3.5:7b
# Point Claude Code at your local Ollama instance
export ANTHROPIC_BASE_URL="http://localhost:11434/v1"
export ANTHROPIC_API_KEY="ollama" # Ollama doesn't need a real key
export CLAUDE_CODE_MODEL="qwen3.5:35b" # Match the model you pulled # Now launch Claude Code normally
claude
# Point Claude Code at your local Ollama instance
export ANTHROPIC_BASE_URL="http://localhost:11434/v1"
export ANTHROPIC_API_KEY="ollama" # Ollama doesn't need a real key
export CLAUDE_CODE_MODEL="qwen3.5:35b" # Match the model you pulled # Now launch Claude Code normally
claude
# Point Claude Code at your local Ollama instance
export ANTHROPIC_BASE_URL="http://localhost:11434/v1"
export ANTHROPIC_API_KEY="ollama" # Ollama doesn't need a real key
export CLAUDE_CODE_MODEL="qwen3.5:35b" # Match the model you pulled # Now launch Claude Code normally
claude
echo 'export ANTHROPIC_BASE_URL="http://localhost:11434/v1"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="ollama"' >> ~/.zshrc
echo 'export CLAUDE_CODE_MODEL="qwen3.5:35b"' >> ~/.zshrc
source ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="http://localhost:11434/v1"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="ollama"' >> ~/.zshrc
echo 'export CLAUDE_CODE_MODEL="qwen3.5:35b"' >> ~/.zshrc
source ~/.zshrc
echo 'export ANTHROPIC_BASE_URL="http://localhost:11434/v1"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="ollama"' >> ~/.zshrc
echo 'export CLAUDE_CODE_MODEL="qwen3.5:35b"' >> ~/.zshrc
source ~/.zshrc
Create a Python function that calculates the Fibonacci sequence using dynamic programming. Include type hints and docstring.
Create a Python function that calculates the Fibonacci sequence using dynamic programming. Include type hints and docstring.
Create a Python function that calculates the Fibonacci sequence using dynamic programming. Include type hints and docstring.
# Point Claude Code at OpenRouter
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_API_KEY="sk-or-v1-your-key-here" # Pick your model — here are the best options:
export CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" # Strong coder, ~$0.50/MTok
# export CLAUDE_CODE_MODEL="google/gemma-4-31b" # Free tier available
# export CLAUDE_CODE_MODEL="deepseek/deepseek-v3.2" # Great reasoning, ~$0.27/MTok
# export CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" # Full Claude, but cheaper than direct API claude
# Point Claude Code at OpenRouter
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_API_KEY="sk-or-v1-your-key-here" # Pick your model — here are the best options:
export CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" # Strong coder, ~$0.50/MTok
# export CLAUDE_CODE_MODEL="google/gemma-4-31b" # Free tier available
# export CLAUDE_CODE_MODEL="deepseek/deepseek-v3.2" # Great reasoning, ~$0.27/MTok
# export CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" # Full Claude, but cheaper than direct API claude
# Point Claude Code at OpenRouter
export ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1"
export ANTHROPIC_API_KEY="sk-or-v1-your-key-here" # Pick your model — here are the best options:
export CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" # Strong coder, ~$0.50/MTok
# export CLAUDE_CODE_MODEL="google/gemma-4-31b" # Free tier available
# export CLAUDE_CODE_MODEL="deepseek/deepseek-v3.2" # Great reasoning, ~$0.27/MTok
# export CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" # Full Claude, but cheaper than direct API claude
# Add to ~/.zshrc or ~/.bashrc # Free local model — for exploration, simple tasks
alias claude-local='ANTHROPIC_BASE_URL="http://localhost:11434/v1" ANTHROPIC_API_KEY="ollama" CLAUDE_CODE_MODEL="qwen3.5:35b" claude' # Cheap cloud model — for feature development
alias claude-cheap='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" claude' # Full Claude Sonnet — when quality matters
alias claude-sonnet='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" claude' # Direct Anthropic API — when you need Opus
alias claude-opus='ANTHROPIC_API_KEY="sk-ant-YOUR-KEY" CLAUDE_CODE_MODEL="claude-opus-4-6" claude'
# Add to ~/.zshrc or ~/.bashrc # Free local model — for exploration, simple tasks
alias claude-local='ANTHROPIC_BASE_URL="http://localhost:11434/v1" ANTHROPIC_API_KEY="ollama" CLAUDE_CODE_MODEL="qwen3.5:35b" claude' # Cheap cloud model — for feature development
alias claude-cheap='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" claude' # Full Claude Sonnet — when quality matters
alias claude-sonnet='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" claude' # Direct Anthropic API — when you need Opus
alias claude-opus='ANTHROPIC_API_KEY="sk-ant-YOUR-KEY" CLAUDE_CODE_MODEL="claude-opus-4-6" claude'
# Add to ~/.zshrc or ~/.bashrc # Free local model — for exploration, simple tasks
alias claude-local='ANTHROPIC_BASE_URL="http://localhost:11434/v1" ANTHROPIC_API_KEY="ollama" CLAUDE_CODE_MODEL="qwen3.5:35b" claude' # Cheap cloud model — for feature development
alias claude-cheap='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="qwen/qwen3.5-coder-next" claude' # Full Claude Sonnet — when quality matters
alias claude-sonnet='ANTHROPIC_BASE_URL="https://openrouter.ai/api/v1" ANTHROPIC_API_KEY="sk-or-v1-YOUR-KEY" CLAUDE_CODE_MODEL="anthropic/claude-sonnet-4.5" claude' # Direct Anthropic API — when you need Opus
alias claude-opus='ANTHROPIC_API_KEY="sk-ant-YOUR-KEY" CLAUDE_CODE_MODEL="claude-opus-4-6" claude'
# Exploring a new codebase? Free.
claude-local # Building a feature? Pennies.
claude-cheap # Debugging a race condition in your distributed system? Worth paying for.
claude-opus
# Exploring a new codebase? Free.
claude-local # Building a feature? Pennies.
claude-cheap # Debugging a race condition in your distributed system? Worth paying for.
claude-opus
# Exploring a new codebase? Free.
claude-local # Building a feature? Pennies.
claude-cheap # Debugging a race condition in your distributed system? Worth paying for.
claude-opus - Claude Opus 4.6: $15 per million input tokens, $75 per million output tokens
- Claude Sonnet 4.5: $3 per million input tokens, $15 per million output tokens - macOS, Linux, or Windows (with WSL2)
- 16GB+ RAM (32GB recommended for larger models)
- ~20GB free disk space per model
- A reasonably modern CPU — Apple Silicon (M1+) or a recent AMD/Intel with AVX2 - Go to openrouter.ai
- Create an account (free)
- Generate an API key from your dashboard
- Add credits — $5 will last weeks for most users - The Claude Code harness — file reading, code writing, -weight: 500;">git operations, shell commands, the entire agent workflow
- Multi-file editing — Claude Code's ability to work across your whole project
- CLAUDE.md and hooks — your project context and automation rules still work
- Terminal UI — same interface, same commands, same muscle memory - Raw intelligence drops. Qwen 3.5 35B is ~85% of Claude Sonnet on coding benchmarks. For complex multi-step reasoning, you'll notice the gap. The hidden cost of cheaper reasoning models is real — they make more subtle mistakes.
- Context window shrinks. Most local models max out at 32K-128K tokens vs. Claude's 1M. For large codebases, this means Claude Code can't hold your entire project in context simultaneously.
- Speed varies wildly. On an M4 Max, Qwen 3.5 35B runs at ~25 tok/s. On an older Intel MacBook, you might get 3-5 tok/s. Opus via API gives you ~80 tok/s consistently.
- Your machine is busy. Running a 35B model uses 20-30GB of RAM and significant CPU/GPU. Don't expect to be running other heavy workloads simultaneously. - Latency is higher. Requests route through OpenRouter's proxy, adding 100-500ms per request compared to direct API calls.
- Free models have rate limits. The free tier on models like Gemma 4 restricts requests per minute. Heavy sessions will hit these.
- Model availability isn't guaranteed. If a provider goes down, that model goes down with it. OpenRouter's routing helps, but it's not immune. - You have 16GB+ RAM (32GB ideal)
- Privacy matters — your code never leaves your machine
- You do mostly routine coding (CRUD, scripts, tests, frontend)
- You want zero ongoing costs
- You're comfortable with ~85% of Claude's quality for most tasks - Your machine can't run large models (8GB laptop, Chromebook)
- You want access to multiple model providers through one API
- You need near-frontier quality but can't justify Opus pricing
- You want the flexibility to switch models per task
- You're OK with $5-25/month instead of $0 - You're a power user who wants the alias-switching setup above
- Use local models for exploration and simple tasks (free)
- Route to cloud models for complex work (cheap)
- Only pay full Anthropic API rates for genuinely hard problems (rare)