# Qwen Code Integration Guide

Qwen Code is an open-source terminal AI coding tool by Alibaba Cloud that supports code understanding, task automation, and multi-IDE integration (VS Code, JetBrains, Zed). This guide explains how to configure it to call models via the UModelverse platform.

## **1. Install Qwen Code**

### macOS (recommended via Homebrew)

```bash
brew install qwen-code
```

### npm (cross-platform, requires Node.js 22+)

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

### Linux/macOS one-line install

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

Verify the installation:

```bash
qwen --version
```

## **2. Configure the UModelverse API**

### 2.1 Get an API Key

Visit the [UModelverse Console](https://console.ucloud.cn/modelverse/api) to obtain your API key. For available models, see the [supported models](https://api-us-ca.umodelverse.ai/v1/models) on the UModelverse platform.

### 2.2 Write the configuration file

Edit `~/.qwen/settings.json` with the content below (replace `YOUR_API_KEY` with your actual key and `MODEL_ID` with one of the [supported models](https://api-us-ca.umodelverse.ai/v1/models) on UModelverse):

```json
{
  "env": {
    "MODELVERSE_API_KEY": "YOUR_API_KEY"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "MODEL_ID",
        "name": "MODEL_ID",
        "baseUrl": "https://api-us-ca.umodelverse.ai/v1",
        "envKey": "MODELVERSE_API_KEY"
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "model": {
    "name": "MODEL_ID"
  }
}
```

## **3. Start Qwen Code**

Once configured, navigate to your project directory and launch:

```bash
cd your-project-folder
qwen
```

Use the `/model` command in the interactive UI to switch models at any time.

## **FAQ**

### Authentication failure or connection error?

Check the following:

1. `env.MODELVERSE_API_KEY` is copied from the UModelverse platform — complete and with no extra spaces.

2. `baseUrl` is `https://api-us-ca.umodelverse.ai/v1` (with the `/v1` suffix).

3. Both `id` and `model.name` exactly match one of the [supported models](https://api-us-ca.umodelverse.ai/v1/models) on the UModelverse platform.
