⌘K

Qwen Code

Overview

Qwen Code supports OpenAI-compatible model providers through ~/.qwen/settings.json. Add Vtrix as an OpenAI-compatible provider, set the Vtrix base URL, and select a Vtrix model.

Prerequisites

  • Node.js 22 or higher when installing with npm
  • Qwen Code
  • A Vtrix API key, created in Settings
Optional: use Vtrix Doctor

You can also use Vtrix Doctor to check the local Base URL, API key, and model settings before editing files. Supported tools, including OpenClaw and Hermes, can be configured after confirmation.

Configuration Steps

1

Install Qwen Code

• Using the install script

curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash

• Or using npm

npm install -g @qwen-code/qwen-code@latest

After installation, run:

qwen --version
2

Set your Vtrix API key

Add the following to ~/.bashrc or ~/.zshrc:

export VTRIX_API_KEY="YOUR_VTRIX_API_KEY"

After updating the file, restart your terminal or run:

source ~/.zshrc
3

Configure the Vtrix provider

Create ~/.qwen/settings.json:

mkdir -p ~/.qwen
vim ~/.qwen/settings.json

Add the following configuration:

{
  "modelProviders": {
    "openai": {
      "protocol": "openai",
      "models": [
        {
          "id": "qwen3.7-max",
          "name": "Qwen3.7 Max via Vtrix",
          "baseUrl": "https://cloud.vtrix.ai/llm",
          "description": "Qwen3.7 Max routed through the Vtrix OpenAI-compatible endpoint",
          "envKey": "VTRIX_API_KEY"
        }
      ]
    }
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "model": {
    "name": "qwen3.7-max"
  }
}
Base URL

Use https://cloud.vtrix.ai/llm as the OpenAI-compatible Vtrix base URL. Qwen Code reads the actual API key from the VTRIX_API_KEY environment variable named by envKey.

4

Start Qwen Code

Go to your project directory and start Qwen Code:

cd /path/to/your/project
qwen

For a one-off check, use headless mode:

qwen -p "Summarize this project in one sentence"

If Qwen Code responds normally, requests are routed to Vtrix through the configured base URL. You can also check usage or billing in Vtrix Settings.

Troubleshooting

Error: 401 Unauthorized

Cause: VTRIX_API_KEY is missing, incorrect, or not loaded in the current terminal session.

Fix:

echo $VTRIX_API_KEY

If the value is empty, check your shell config and restart the terminal.

Qwen Code starts with a different provider

Cause: security.auth.selectedType is not set to openai, or another settings file overrides the user settings.

Fix: Confirm ~/.qwen/settings.json contains:

{
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  }
}
Error: model not found

Cause: model.name or the model id does not match a Vtrix model ID.

Fix: Open the Models page, copy the correct model ID, and update both model.name and the matching modelProviders.openai.models[].id.

Other configuration issues
  • Confirm protocol is openai
  • Confirm baseUrl is https://cloud.vtrix.ai/llm
  • Confirm envKey is VTRIX_API_KEY
  • Restart Qwen Code after editing ~/.qwen/settings.json