Get Qwen Coder and Vision Models Running for Free
I used to get hit with high API bills just for testing small scripts or debugging code. Then I realized Qwen offers a free tier for their Coder and Vision models through an OAuth flow. Getting 2,000 requests a day without paying a cent changed how I handle my daily dev tasks.
I found that the setup is fast, but you have to follow the steps in order to get the authentication right. Here is how I get it working in under five minutes.
What You’ll Need
Section titled “What You’ll Need”- OpenClaw installed on your machine.
- An active Qwen account.
- The OpenClaw CLI ready in your terminal.
- A few minutes to click through the OAuth screens.
Quick Start
Section titled “Quick Start”I recommend using the qwen-portal-auth plugin because it handles the token refresh for you. Follow these steps to get started.
1. Enable the plugin Run this command to tell OpenClaw to use the Qwen portal logic:
openclaw plugins enable qwen-portal-auth2. Restart the Gateway You need to restart your OpenClaw Gateway process so it can load the plugin you just enabled.
3. Authenticate your account Run the login command. This starts a device-code flow. It will give you a link to open in your browser where you can sign in to Qwen.
openclaw models auth login --provider qwen-portal --set-defaultThis command also sets Qwen as your default provider and creates a qwen alias for you.
4. Select your model I usually stick with the coder model for my terminal work. You can switch to it instantly:
openclaw models set qwen-portal/coder-modelIf you need to process images, use qwen-portal/vision-model instead.
Troubleshooting
Section titled “Troubleshooting”Token Refresh Failures
Sometimes the auto-refresh fails if your internet connection drops or if Qwen revokes the session. If you see auth errors, just run the login command again. It resets the tokens in your models.json and gets you back online.
Syncing from Qwen Code CLI
If you used the Qwen Code CLI before, OpenClaw tries to grab your credentials from ~/.qwen/oauth_creds.json. However, you still need to run the openclaw models auth login command once. This ensures the models.providers.qwen-portal entry is correctly formatted in your OpenClaw config.
If you hit a wall or get an error I didn’t mention, talk to the AI Setup Assistant.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.