cd /news/ai-tools/run-qwen-4-max-inside-claude-code-vi… · home › topics › ai-tools › article
[ARTICLE · art-172261] src=gist.github.com ↗ pub= topic=ai-tools verified=true sentiment=· neutral

Run Qwen 4 Max inside Claude Code via OpenRouter (~/.zshrc setup)

A developer published a shell configuration that routes Claude Code through OpenRouter to run Qwen 4 Max as the backing model, using a subshell function in ~/.zshrc so the override applies only to that session. The setup sets ANTHROPIC_BASE_URL to OpenRouter's API, points all model variables at qwen/qwen4-max, and enables the /effort reasoning switch while leaving plain `claude` on its normal configuration.

recommendation

Route Claude Code to an alternative model through OpenRouter by exporting the base URL, auth token and model IDs inside a subshell function so your default configuration stays untouched.

more in playbook: Controlling LLM cost
by read1 min views2 publishedNov 18, 2026

| | # Run Qwen 4 Max inside Claude Code via OpenRouter | | | # From the video "Qwen 4 Max: I made it edit my video (setup + honest take)" | | | # | | | # 1. Create an OpenRouter API key (openrouter.ai → Workspaces → Keys → New key; set a credit limit) | | | # 2. Paste this at the end of ~/.zshrc (macOS) and put your key in | | | # 3. Run: source ~/.zshrc | | | # 4. Start it with: claude-qwen (plain claude stays on your normal setup) | | | # Use /effort to switch reasoning: low → low, medium/high → high, xhigh/max → extra high | | | claude-qwen() ( # ( ) = subshell: these vars only apply to this run | | | export ANTHROPIC_BASE_URL="https://openrouter.ai/api" | | | export ANTHROPIC_AUTH_TOKEN="<your OpenRouter key>" # never commit or share your real key | | | export ANTHROPIC_API_KEY="" # keep empty so Claude Code uses OpenRouter | | | export ANTHROPIC_MODEL="qwen/qwen4-max" # must match the model id on OpenRouter | | | export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen/qwen4-max" | | | export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen/qwen4-max" | | | export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen/qwen4-max" | | | export CLAUDE_CODE_SUBAGENT_MODEL="qwen/qwen4-max" | | | export CLAUDE_CODE_ALWAYS_ENABLE_EFFORT=1 # unlocks /effort | | | claude "$@" | | | ) |

── more in #ai-tools 4 stories · sorted by recency
── more on @qwen 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/run-qwen-4-max-insid…] indexed:0 read:1min 2026-11-18 · —