Qwen Code
Qwen Code is a terminal-based AI coding tool that can be connected to Alibaba Cloud Model Studio via pay-as-you-go, Coding Plan, Token Plan (Personal Edition), or Token Plan (Team Edition).
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. See Integrate Bailian CLI.
- Web development: Provide a screenshot of a target website, and Qwen Code parses the page structure to generate high-fidelity front-end code. See Replicate a website style with a single prompt.
- Video production: Given an open-source repository URL, generate a dedicated promotional video in one step. See Create a promotional video for an open-source project.
- Model Studio integration: Call Model Studio capabilities such as image and video generation through the Bailian CLI in conversation, extending Qwen Code to more AI scenarios. See Integrate Bailian CLI.
Install Qwen Code
-
Run the installation command
-
macOS/Linux:
Open a terminal and run the following command to install Qwen Code.
-
macOS/Linux:
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source bailian
-
Windows:
Type
cmdin the taskbar search box, select Run as administrator, and run the following command in thecmdwindow to install Qwen Code.
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
-
Close and reopen the
cmdwindowOn Windows, after installation is complete, close the current
cmdwindow to apply the environment variables. Reopencmdand run the following command to check the installed version.
qwen --version
Configure Access Credentials
Launch Qwen Code and type /auth for visual configuration. Alibaba Cloud Model Studio 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.
- Coding Plan: Fixed monthly subscription, metered by model invocation count.
- 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. Available models include qwen3.8-max, qwen3.7-max, qwen3.7-plus, qwen3.6-flash, 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. The file path is as follows:
- macOS/Linux:
~/.qwen/settings.json - Windows:
C:\Users\<Username>\.qwen\settings.json
{
"env": {
"BAILIAN_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
},
"modelProviders": {
"openai": [
{
"id": "qwen3.8-max",
"name": "[Token Plan Personal] qwen3.8-max",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "glm-5.2",
"name": "[Token Plan Personal] glm-5.2",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-pro",
"name": "[Token Plan Personal] deepseek-v4-pro",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-pro-0813",
"name": "[Token Plan Personal] deepseek-v4-pro-0813",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-flash-0731",
"name": "[Token Plan Personal] deepseek-v4-flash-0731",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4.1-flash",
"name": "[Token Plan Personal] deepseek-v4.1-flash",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
}
]
}
}
Token Plan (Team Edition)
Launch Qwen Code and type /auth, then select Subscription Plan > Alibaba Cloud Model Studio Token Plan, and enter the Token Plan (Team Edition) dedicated API Key to complete the configuration. For available models, see Token Plan (Team Edition) supported models.
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
{
"env": {
"BAILIAN_TOKEN_PLAN_API_KEY": "YOUR_API_KEY"
},
"modelProviders": {
"openai": [
{
"id": "qwen3.8-max",
"name": "[Token Plan Team Edition] qwen3.8-max",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-pro-0813",
"name": "[Token Plan Team Edition] deepseek-v4-pro-0813",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-flash",
"name": "[Token Plan Team Edition] deepseek-v4-flash",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4-flash-0731",
"name": "[Token Plan Team Edition] deepseek-v4-flash-0731",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v4.1-flash",
"name": "[Token Plan Team Edition] deepseek-v4.1-flash",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "deepseek-v3.2",
"name": "[Token Plan Team Edition] deepseek-v3.2",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
},
{
"id": "kimi-k2.7-code",
"name": "[Token Plan Team Edition] kimi-k2.7-code",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "glm-5",
"name": "[Token Plan Team Edition] glm-5",
"baseUrl": "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_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.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
}
]
},
"security": {
"auth": {
"selectedType": "openai"
}
},
"tokenPlan": {
"region": "china"
},
"model": {
"name": "qwen3.8-max"
},
"$version": 3
}
Coding Plan
Launch Qwen Code and type /auth, then select Subscription Plan > Alibaba Cloud Model Studio Coding Plan, choose the Coding Plan region (china), and enter the Coding Plan dedicated API Key to complete the configuration. For available models, see Coding Plan supported models.
Advanced configuration: via settings.json
Edit or create a settings.json file and replace YOUR_API_KEY with your Coding Plan dedicated API Key. The file path is as follows:
- macOS/Linux:
~/.qwen/settings.json - Windows:
C:\Users\<Windows username>\.qwen\settings.json
{
"env": {
"BAILIAN_CODING_PLAN_API_KEY": "YOUR_API_KEY"
},
"modelProviders": {
"openai": [
{
"id": "qwen3.7-plus",
"name": "[Bailian Coding Plan] qwen3.7-plus",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "qwen3.6-plus",
"name": "[Bailian Coding Plan] qwen3.6-plus",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "qwen3.5-plus",
"name": "[Bailian Coding Plan] qwen3.5-plus",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "qwen3-max-2026-01-23",
"name": "[Bailian Coding Plan] qwen3-max-2026-01-23",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
},
{
"id": "qwen3-coder-next",
"name": "[Bailian Coding Plan] qwen3-coder-next",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
},
{
"id": "qwen3-coder-plus",
"name": "[Bailian Coding Plan] qwen3-coder-plus",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
},
{
"id": "MiniMax-M2.5",
"name": "[Bailian Coding Plan] MiniMax-M2.5",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
},
{
"id": "glm-5",
"name": "[Bailian Coding Plan] glm-5",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
},
{
"id": "glm-4.7",
"name": "[Bailian Coding Plan] glm-4.7",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY"
},
{
"id": "kimi-k2.5",
"name": "[Bailian Coding Plan] kimi-k2.5",
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"envKey": "BAILIAN_CODING_PLAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
}
]
},
"security": {
"auth": {
"selectedType": "openai"
}
},
"codingPlan": {
"region": "china"
},
"model": {
"name": "qwen3.7-plus"
},
"$version": 3
}
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 Alibaba Cloud Model Studio API Key to complete the configuration. For available models, see OpenAI-compatible - Supported Models.
Advanced configuration: via settings.json
Edit or create a settings.json file and replace YOUR_API_KEY with your Alibaba Cloud Model Studio API Key. The file path is as follows:
- macOS/Linux:
~/.qwen/settings.json - Windows:
C:\Users\<Windows username>\.qwen\settings.json
Set baseUrl according to the region. The API Key must correspond to the selected region, replace {WorkspaceId} in the URL with your actual Workspace ID:
- China(Beijing):
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 - Singapore:
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 - US (Virginia):
https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1
{
"env": {
"BAILIAN_API_KEY": "YOUR_API_KEY"
},
"modelProviders": {
"openai": [
{
"id": "qwen3.6-plus",
"name": "[Bailian] qwen3.6-plus",
"baseUrl": "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"envKey": "BAILIAN_API_KEY",
"generationConfig": {
"extra_body": {
"enable_thinking": true
}
}
}
]
},
"security": {
"auth": {
"selectedType": "openai"
}
},
"model": {
"name": "qwen3.6-plus"
},
"$version": 3
}
To add other models, append them in the same format within modelProviders.openai.
Verify Configuration
After configuration is complete, run the following command in your project directory to launch Qwen Code and start a conversation.
qwen
Qwen Code IDE Plugins
Qwen Code supports usage as a plugin in VS Code, providing AI coding capabilities within the IDE.
VS Code
Ensure your VS Code version is 1.85.0 or higher before use.
- Open VS Code, search for
Qwen Code Companionin the Extensions Marketplace and install it. - 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 section above. - Click the icon in the upper-right corner to launch Qwen Code. Type or click
/, then selectSwitch modelto switch models.
Qwen Code Desktop
Qwen Code Desktop is the GUI application of Qwen Code with built-in CLI runtime, requiring no additional command-line tool installation. The desktop version shares the same settings.json configuration file with CLI. If you have already completed configuration through CLI, the desktop version is ready to use without additional setup.
If you have not configured yet, you can do so through the desktop GUI:
-
Open Qwen Code Desktop, click Settings on the left sidebar, and select the AI tab.
-
In the Model Provider section, click + Connect.
-
In the popup, select the Alibaba ModelStudio tab and choose the billing plan that suits your needs:
- Coding Plan: For individual developers, metered by invocations.
- Token Plan: For teams, billed by token consumption.
- Standard API Key: Pay-as-you-go with an existing ModelStudio API Key.
-
Enter the API Key as prompted to complete the configuration.
Common Commands
NoteThe following commands apply to Qwen Code CLI. The IDE plugin only supports some commands. Please refer to actual usage.
Command | Description | Example |
|---|---|---|
| Switch the model used in the current session. |
|
| Change the authentication method. |
|
| Analyze the current directory and create an initial context file (QWEN.md) for defining project-level instructions and context. |
|
| Clear the terminal screen and start a new conversation. |
|
| Replace chat history with a summary to save tokens. |
|
| Open the settings editor to configure language, theme, and more. |
|
| Generate a project summary based on the conversation history. |
|
| Resume a previous conversation session. |
|
| Display detailed statistics for the current session. |
|
| Display help information for available commands. |
|
| Exit Qwen Code. |
|
For more advanced features of Qwen Code, see the Qwen Code official documentation.
Use Cases
Integrate Bailian CLI
Bailian CLI registers a Skill at ~/.qwen/skills/bailian-cli/ during installation, allowing Qwen Code to invoke Bailian capabilities through conversation. For the full capability list, see the Bailian CLI console. Prerequisite: Node.js 18+.
- Tell Qwen Code to install Bailian CLI:
Please install the Alibaba Cloud Bailian CLI globally: npm install -g bailian-cli
- Go to the Bailian console to get your API Key, then tell Qwen Code to configure it:
My API Key is: sk-xxxxxxxxxxxxx
- Describe what you need in natural language, for example:
Generate 6 Amazon e-commerce hero images for a white wireless Bluetooth headset.
Generate a 30-second product demo video for a white wireless Bluetooth headset.
Replicate a website style with a single prompt
Provide a screenshot of a target website, and Qwen Code automatically parses the page structure and generates high-fidelity front-end code.
Replicate the style of the following website ![]() | Demo |
Configuration steps
- Install and configure Qwen Code.
- Type
qwenin the terminal to launch Qwen Code. - Enter the following to install the extension, and select
ui-designto complete the installation.
/extensions install wshobson/agents
Warningwshobson/agents and vercel-labs/skills are third-party repositories. Their scripts and code are not reviewed or maintained by Alibaba Cloud. Before you install third-party extensions or Skills, evaluate the trustworthiness of their sources and the security of their code, and use them with caution in production environments.
- Enter the following to install the skill.
Please check if I have find skills, if not install it directly: npx skills add https://github.com/vercel-labs/skills --skill find-skills -y -a qwen-code, then help me install web-component-design from wshobson/agents to the current directory: npx skills add https://github.com/wshobson/agents --skill web-component-design -y
- Download website.png to your project directory, then enter the following. It will automatically identify the layout and styles from the screenshot and generate web page code.
/skills web-component-design 根据这个技能,基于 @website.png 帮我复刻一个网页html,注意图片引用需有效。
Create a promotional video for an open-source project
Provide an open-source project repository URL to generate a dedicated promotional video with a single command.
Repository URL: https://github.com/QwenLM/qwen-code.
Configuration steps
- Install and configure Qwen Code.
- Type
qwenin the terminal to launch Qwen Code. - Enter the following to create the video.
基于这个技能 https://github.com/QwenLM/qwen-code-examples/blob/main/skills/oss-styles/SKILL.md,帮我为开源仓库:https://github.com/QwenLM/qwen-code 生成一个演示视频
Learn More
- For advanced features such as sub-agents, MCP, and Skills in Qwen Code, see the Qwen Code official documentation.
- For Qwen Code use cases, see Use Cases.
FAQ
Error Codes
If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:
- Pay-as-you-go: Error codes
- Coding Plan: Coding Plan FAQ
- Token Plan (Personal Edition): Token Plan FAQ
- Token Plan (Team Edition): Token Plan (Team Edition) 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.
