| | # 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 "$@" |
| | ) |
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.
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 costRun 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.