How to Integrate Qwen Models in Openclaw: Step-by-Step Guide

Image
Table of contents: [Show]

Quick Start

Qwen is Alibaba Cloud's powerful large language model series, offering strong coding and vision capabilities. This guide shows you how to integrate Qwen models into your Openclaw setup in under 5 minutes.

Openclaw Qwen Models Integration

Enable the Qwen Plugin

Openclaw includes a bundled plugin for Qwen portal authentication that is disabled by default. You must enable it and then restart the Gateway:

openclaw plugins enable qwen-portal-auth openclaw gateway restart

Note: If you are running the gateway manually, stop it and restart it after running the enable command.

Authenticate with Qwen

Run the login command to trigger the Qwen device-code OAuth flow:

openclaw models auth login --provider qwen-portal --set-default

This will open a browser window for authentication. Once complete, your Qwen credentials are stored securely.

Available Qwen Models

Once authenticated, you can switch to the Qwen models using their specific IDs:

  • qwen-portal/coder-model — Optimized for code generation and technical tasks
  • qwen-portal/vision-model — Multimodal model supporting image understanding

You can set your default model via the CLI:

openclaw models set qwen-portal/coder-model

If you are exploring other model providers, check out our guide on GLM Models Openclaw. For advanced configuration options, you might also want to read about Elevated Mode Openclaw.

Example Usage

Once configured, test your Qwen integration:

User: "Write a Python function to parse JSON and extract nested values"

Agent: [Uses qwen-portal/coder-model]
Result: 
def extract_nested(data, path):
    keys = path.split('.')
    value = data
    for key in keys:
        value = value.get(key)
        if value is None:
            return None
    return value

Troubleshooting

  • Authentication fails: Ensure the qwen-portal-auth plugin is enabled and the gateway was restarted.
  • Model not found: Verify you're using the correct model ID prefix qwen-portal/.
  • Gateway not responding: Check that the gateway is running with openclaw gateway status.

Best Practices

  • Use the coder-model for programming tasks and technical documentation.
  • Use the vision-model when you need image analysis capabilities.
  • Set Qwen as your default if it's your primary model to avoid specifying it each time.

Ready to code? Your Openclaw agent now has access to Qwen's powerful language capabilities.