> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwencloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen Code

> Official terminal-based AI coding tool

Connect it to QwenCloud via Token Plan (Personal Edition), Token Plan (Team Edition), or pay-as-you-go billing.

## Common scenarios

Qwen Code supports the following scenarios:

- **AI-assisted coding**: Generate, complete, and review code from the terminal using natural language to speed up everyday development.
- **Web development**: Provide a screenshot of a target website, and Qwen Code parses the page structure to generate high-fidelity front-end code.
- **Video production**: Given an open-source repository URL, generate a dedicated promotional video in one step.

## Install Qwen Code

<Tabs>
  <Tab title="macOS/Linux">
    Open a terminal and run the following command to install Qwen Code.

    ```bash
    bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source bailian
    ```
  </Tab>

  <Tab title="Windows">
    Type `cmd` in the taskbar search box, select **Run as administrator**, and run the following command in the `cmd` window to install Qwen Code.

    ```sh
    curl -fsSL -o %TEMP%\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\install-qwen.bat --source bailian
    ```

    On Windows, after installation is complete, close the current `cmd` window to apply the environment variables. Reopen `cmd` and run the following command to check the installed version.

    ```bash
    qwen --version
    ```
  </Tab>
</Tabs>

## Configure access credentials

Launch Qwen Code and type `/auth` for visual configuration. QwenCloud offers the following billing plans. Choose based on your needs:

- **Token Plan (Personal Edition)**: Deducts personal Credits based on token consumption.
- **Token Plan (Team Edition)**: Subscription per seat, with token consumption deducted from Credits.
- **Pay-as-you-go**: Post-paid based on actual usage.

### Token Plan (Personal Edition)

Edit or create a `settings.json` file and replace `YOUR_API_KEY` with your Token Plan (Personal Edition) dedicated [API Key](https://home.qwencloud.com/api-keys). Available models include qwen3.8-max, qwen3.8-flash, qwen3.7-max, qwen3.7-plus, qwen3.6-flash, glm-5.3, glm-5.2, deepseek-v4-pro, deepseek-v4-pro-0813, and deepseek-v4-flash-0731. For the full list, see Token Plan (Personal Edition) [supported models](/token-plan/personal/token-plan-personal-overview#supported-models). The file path is as follows:

- macOS/Linux: `~/.qwen/settings.json`
- Windows: `C:\Users\<Username>\.qwen\settings.json`

```json
{
  "env": {
    "QWENCLOUD_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "auto",
        "name": "[Token Plan Personal] auto",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "qwen3.8-max",
        "name": "[Token Plan Personal] qwen3.8-max",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "qwen3.8-flash",
        "name": "[Token Plan Personal] qwen3.8-flash",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "qwen3.7-max",
        "name": "[Token Plan Personal] qwen3.7-max",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "qwen3.7-plus",
        "name": "[Token Plan Personal] qwen3.7-plus",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "qwen3.6-flash",
        "name": "[Token Plan Personal] qwen3.6-flash",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "glm-5.3",
        "name": "[Token Plan Personal] glm-5.3",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "glm-5.2",
        "name": "[Token Plan Personal] glm-5.2",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "deepseek-v4-pro",
        "name": "[Token Plan Personal] deepseek-v4-pro",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "deepseek-v4-pro-0813",
        "name": "[Token Plan Personal] deepseek-v4-pro-0813",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "deepseek-v4-flash-0731",
        "name": "[Token Plan Personal] deepseek-v4-flash-0731",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "deepseek-v4.1-flash",
        "name": "[Token Plan Personal] deepseek-v4.1-flash",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "deepseek-v4.1-flash-1017",
        "name": "[Token Plan Personal] deepseek-v4.1-flash-1017",
        "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
        "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "tokenPlan": {
    "region": "global"
  },
  "model": {
    "name": "auto"
  },
  "$version": 3
}
```

<Warning>
  **qwen3.8-max thinking mode**:

  - thinking: Supports both enabled and disabled (hybrid thinking mode).
  - temperature: Defaults to 0.6 in thinking mode. Values below 0.6 are automatically adjusted to 0.6.
  - reasoning\_effort: Controls reasoning depth. Options: xhigh, medium, low. Default: xhigh.
</Warning>

### Token Plan (Team Edition)

Launch Qwen Code and type `/auth`, then select **Subscription Plan** > **QwenCloud Token Plan**, and enter the Token Plan (Team Edition) dedicated [API Key](https://home.qwencloud.com/api-keys) to complete the configuration. For available models, see Token Plan (Team Edition) [supported models](/token-plan/team/token-plan-team-overview#supported-models).

<Accordion title="Advanced configuration: via settings.json">
  Edit or create a `settings.json` file and replace `YOUR_API_KEY` with your Token Plan (Team Edition) dedicated API Key. The file path is as follows:

  - macOS/Linux: `~/.qwen/settings.json`
  - Windows: `C:\Users\<Windows username>\.qwen\settings.json`

  ```json
  {
    "env": {
      "QWENCLOUD_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
    },
    "modelProviders": {
      "openai": [
        {
          "id": "auto",
          "name": "[Token Plan Team Edition] auto",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "qwen3.8-max",
          "name": "[Token Plan Team Edition] qwen3.8-max",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "qwen3.8-flash",
          "name": "[Token Plan Team Edition] qwen3.8-flash",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "qwen3.7-max",
          "name": "[Token Plan Team Edition] qwen3.7-max",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "qwen3.7-plus",
          "name": "[Token Plan Team Edition] qwen3.7-plus",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "qwen3.6-plus",
          "name": "[Token Plan Team Edition] qwen3.6-plus",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "qwen3.6-flash",
          "name": "[Token Plan Team Edition] qwen3.6-flash",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "deepseek-v4-pro",
          "name": "[Token Plan Team Edition] deepseek-v4-pro",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "deepseek-v4-pro-0813",
          "name": "[Token Plan Team Edition] deepseek-v4-pro-0813",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "deepseek-v4-flash-0731",
          "name": "[Token Plan Team Edition] deepseek-v4-flash-0731",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "deepseek-v4.1-flash",
          "name": "[Token Plan Team Edition] deepseek-v4.1-flash",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "deepseek-v4.1-flash-1017",
          "name": "[Token Plan Team Edition] deepseek-v4.1-flash-1017",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        },
        {
          "id": "kimi-k2.7-code",
          "name": "[Token Plan Team Edition] kimi-k2.7-code",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "kimi-k2.6",
          "name": "[Token Plan Team Edition] kimi-k2.6",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "kimi-k2.5",
          "name": "[Token Plan Team Edition] kimi-k2.5",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "glm-5.3",
          "name": "[Token Plan Team Edition] glm-5.3",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "glm-5.2",
          "name": "[Token Plan Team Edition] glm-5.2",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "glm-5.1",
          "name": "[Token Plan Team Edition] glm-5.1",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "glm-5",
          "name": "[Token Plan Team Edition] glm-5",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        },
        {
          "id": "MiniMax-M2.5",
          "name": "[Token Plan Team Edition] MiniMax-M2.5",
          "baseUrl": "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "QWENCLOUD_TOKEN_PLAN_API_KEY"
        }
      ]
    },
    "security": {
      "auth": {
        "selectedType": "openai"
      }
    },
    "tokenPlan": {
      "region": "global"
    },
    "model": {
      "name": "qwen3.7-plus"
    },
    "$version": 3
  }
  ```
</Accordion>

<Warning>
  **qwen3.8-max thinking mode**:

  - thinking: Supports both enabled and disabled (hybrid thinking mode).
  - temperature: Defaults to 0.6 in thinking mode. Values below 0.6 are automatically adjusted to 0.6.
  - reasoning\_effort: Controls reasoning depth. Options: xhigh, medium, low. Default: xhigh.
</Warning>

### Pay-as-you-go

Launch Qwen Code and type `/auth`, select **Use your own API Key** > **Standard API Key**, then choose the region and enter the [QwenCloud API Key](https://home.qwencloud.com/api-keys) to complete the configuration. For available models, see [OpenAI compatible - Supported models](/api-reference/chat/openai-chat).

<Accordion title="Advanced configuration: via settings.json">
  Edit or create a `settings.json` file and replace `YOUR_API_KEY` with your QwenCloud API Key. The file path is as follows:

  - macOS/Linux: `~/.qwen/settings.json`
  - Windows: `C:\Users\<Windows username>\.qwen\settings.json`

  The following uses the Singapore (ap-southeast-1) endpoint. For another region, replace ap-southeast-1 and use an API key from that region. See [Regions and endpoints](/developer-guides/getting-started/regions).

  ```json
  {
    "env": {
      "DASHSCOPE_API_KEY": "YOUR_API_KEY"
    },
    "modelProviders": {
      "openai": [
        {
          "id": "qwen3.7-plus",
          "name": "[QwenCloud] qwen3.7-plus",
          "baseUrl": "https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1",
          "envKey": "DASHSCOPE_API_KEY",
          "generationConfig": {
            "extra_body": {
              "enable_thinking": true
            }
          }
        }
      ]
    },
    "security": {
      "auth": {
        "selectedType": "openai"
      }
    },
    "model": {
      "name": "qwen3.7-plus"
    },
    "$version": 3
  }
  ```

  To add [other models](/api-reference/chat/openai-chat), append them in the same format within `modelProviders.openai`.
</Accordion>

## Verify configuration

After configuration is complete, run the following command in your project directory to launch Qwen Code and start a conversation.

```bash
qwen
```

## Qwen Code IDE plugins

Qwen Code supports usage as a plugin in VS Code and JetBrains IDE, providing AI coding capabilities within the IDE.

### VS Code

Ensure your VS Code version is 1.85.0 or higher before use.

1. Open VS Code, search for `Qwen Code Companion` in the Extensions Marketplace and install it.
2. The CLI and IDE plugin share the same `settings.json`. If you have already completed the configuration above, skip this step. Otherwise, follow the [Configure access credentials](#configure-access-credentials) section above.
3. Click the icon in the upper-right corner to launch Qwen Code. Type or click `/`, then select `Switch model` to switch models.

### JetBrains IDE

Ensure your JetBrains IDE supports Agent Client Protocol (ACP) before use.

1. Qwen Code IDE depends on Qwen Code CLI. First, follow the [Install Qwen Code](#install-qwen-code) section in this document to install and complete [Configure access credentials](#configure-access-credentials).

2. Open JetBrains IDE, go to the **AI Chat** page, and click **Install Plugin**. IDEA will install the JetBrains AI Assistant plugin.

3. Click the three-dot menu in the upper-right corner of the **AI Chat** window, select **Add Custom Agent**, and fill in the following configuration. Replace `/path/to/qwen` with the Qwen Code installation path. Run the following command to find the path:
   - macOS/Linux: `which qwen`
   - Windows: `where qwen` (CMD) or `Get-Command qwen` (PowerShell)

```json
{
  "agent_servers": {
    "qwen": {
      "command": "/path/to/qwen",
      "args": ["--acp"],
      "env": {}
    }
  }
}
```

4. After configuration, Qwen Code will appear in the **AI Chat** panel. You can switch models in the lower-right corner.

## Qwen Code Desktop

Qwen Code Desktop is the GUI application of Qwen Code with a built-in CLI runtime, requiring no additional command-line tool installation. The desktop version shares the same `settings.json` configuration file with the CLI. If you have already completed configuration through the CLI, the desktop version is ready to use without additional setup.

Visit the [Qwen Code GitHub Releases](https://github.com/QwenLM/qwen-code/releases) page to download the desktop installer for your operating system (macOS, Windows, or Linux).

If you have not configured yet, you can do so through the desktop GUI:

1. Open Qwen Code Desktop, click **Settings** on the left sidebar, and select the **AI** tab.
2. In the **Model Provider** section, click **+ Connect**.
3. In the popup, select the **QwenCloud** tab and choose the billing plan that suits your needs:
   - **Token Plan**: For teams, billed by token consumption.
   - **Standard API Key**: Pay-as-you-go with an existing QwenCloud API Key.
4. Enter the API Key as prompted to complete the configuration.

## Common commands

<Note>
  The following commands apply to Qwen Code CLI. The IDE plugin only supports some commands. Please refer to actual usage.
</Note>

| Command     | Description                                                                 | Example         |
| ----------- | --------------------------------------------------------------------------- | --------------- |
| `/model`    | Switch the model used in the current session.                               | `/model`        |
| `/auth`     | Change the authentication method.                                           | `/auth`         |
| `/init`     | Analyze the current directory and create an initial context file (QWEN.md). | `/init`         |
| `/clear`    | Clear the terminal screen and start a new conversation.                     | `/clear`        |
| `/compress` | Replace chat history with a summary to save tokens.                         | `/compress`     |
| `/settings` | Open the settings editor to configure language, theme, and more.            | `/settings`     |
| `/summary`  | Generate a project summary based on the conversation history.               | `/summary`      |
| `/resume`   | Resume a previous conversation session.                                     | `/resume`       |
| `/stats`    | Display detailed statistics for the current session.                        | `/stats`        |
| `/help`     | Display help information for available commands.                            | `/help` or `/?` |
| `/quit`     | Exit Qwen Code.                                                             | `/quit`         |

For more advanced features of Qwen Code, see the [Qwen Code official documentation](https://qwenlm.github.io/qwen-code-docs/en/users/features/commands/).

## Learn more

- For advanced features such as sub-agents, MCP, and Skills in Qwen Code, see the [Qwen Code official documentation](https://qwenlm.github.io/qwen-code-docs/en/users/overview/).
- For Qwen Code use cases, see [Use Cases](https://qwenlm.github.io/qwen-code-docs/en/showcase/).

## FAQ

### Error codes

If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:

- Pay-as-you-go: [Error codes and troubleshooting](/api-reference/preparation/error-messages)
- Token Plan (Personal Edition): [Token Plan FAQ](/token-plan/personal/token-plan-personal-faq)
- Token Plan (Team Edition): [Token Plan (Team Edition) FAQ](/token-plan/team/token-plan-team-faq)

### How to switch models?

Type the `/model` command directly in Qwen Code to select and switch from the list of models configured in `settings.json`. To add a new model, add the corresponding configuration under `settings.json` in the `modelProviders` section, then restart Qwen Code.
