Connect Qwen Code CLI to OpenRouter for Flexible, Free Models

in #tutorialyesterday

Qwen Code is a powerful command-line AI coding agent, but recent changes removed the old free OAuth access. The good news? It now supports third-party providers—including OpenRouter—so you can keep coding with a wide range of models, many of them free or very low-cost.

In this quick walkthrough you’ll see exactly how to link them. Open the Qwen Code CLI and run the /auth command. Choose the third-party providers option, select OpenRouter, and paste your OpenRouter API key. You’ll immediately get access to available models such as free GLM variants or GPT-OSS options. Switch between them anytime with the simple /model command.

Want more choices? Return to the auth settings and add extra model IDs (for example free Meta Llama or Gemma models found by sorting OpenRouter’s catalog by price). Once connected, your queries run through OpenRouter, and you can monitor usage and spending directly on the OpenRouter activity dashboard.

This setup gives you the full agentic coding experience of Qwen Code while letting you pick the best free or affordable models available on OpenRouter—no lock-in to a single provider. It’s ideal when you want flexibility, cost control, or access to the latest open models.