Skip to main content
Clients & tools

Qwen Code

Official terminal-based AI coding tool

Qwen Code is a terminal-based AI coding tool. Connect it to Qwen Cloud via Token Plan (Team Edition), Coding Plan, or pay-as-you-go billing.

Install Qwen Code

  • macOS/Linux
  • Windows
Open a terminal and run the following command to install Qwen Code.
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source bailian

Configure access credentials

Launch Qwen Code and type /auth for visual configuration. Qwen Cloud offers three billing plans. Choose based on your needs:
  • Token Plan (Team Edition): Subscription per seat, with token consumption deducted from Credits.
  • Coding Plan: Fixed monthly subscription billed by number of model calls.
  • Pay-as-you-go: Post-paid based on actual usage.

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.
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.6-plus",
        "name": "[Token Plan Team Edition] qwen3.6-plus",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "deepseek-v3.2",
        "name": "[Token Plan Team Edition] deepseek-v3.2",
        "baseUrl": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
      },
      {
        "id": "glm-5",
        "name": "[Token Plan Team Edition] glm-5",
        "baseUrl": "https://token-plan.ap-southeast-1.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.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "envKey": "BAILIAN_TOKEN_PLAN_API_KEY"
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "tokenPlan": {
    "region": "global"
  },
  "model": {
    "name": "qwen3.6-plus"
  },
  "$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 (global), and enter the Coding Plan dedicated API Key to complete the configuration. For available models, see Coding Plan supported models.
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.6-plus",
        "name": "[Coding Plan] qwen3.6-plus",
        "baseUrl": "https://coding-intl.dashscope.aliyuncs.com/v1",
        "envKey": "BAILIAN_CODING_PLAN_API_KEY",
        "generationConfig": {
          "extra_body": {
            "enable_thinking": true
          }
        }
      },
      {
        "id": "qwen3-coder-plus",
        "name": "[Coding Plan] qwen3-coder-plus",
        "baseUrl": "https://coding-intl.dashscope.aliyuncs.com/v1",
        "envKey": "BAILIAN_CODING_PLAN_API_KEY"
      }
    ]
  },
  "security": {
    "auth": {
      "selectedType": "openai"
    }
  },
  "codingPlan": {
    "region": "global"
  },
  "model": {
    "name": "qwen3.6-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 Qwen Cloud API Key to complete the configuration. For available models, see OpenAI compatible - Supported models.
Edit or create a settings.json file and replace YOUR_API_KEY with your Qwen Cloud API Key. The file path is as follows:
  • macOS/Linux: ~/.qwen/settings.json
  • Windows: C:\Users\<Windows username>\.qwen\settings.json
{
  "env": {
    "BAILIAN_API_KEY": "YOUR_API_KEY"
  },
  "modelProviders": {
    "openai": [
      {
        "id": "qwen3.6-plus",
        "name": "[Qwen Cloud] qwen3.6-plus",
        "baseUrl": "https://dashscope-intl.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 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 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 section in this document to install and complete 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)
{
  "agent_servers": {
    "qwen": {
      "command": "/path/to/qwen",
      "args": ["--acp"],
      "env": {}
    }
  }
}
  1. After configuration, Qwen Code will appear in the AI Chat panel. You can switch models in the lower-right corner.

Common commands

The following commands apply to Qwen Code CLI. The IDE plugin only supports some commands. Please refer to actual usage.
CommandDescriptionExample
/modelSwitch the model used in the current session./model
/authChange the authentication method./auth
/initAnalyze the current directory and create an initial context file (QWEN.md)./init
/clearClear the terminal screen and start a new conversation./clear
/compressReplace chat history with a summary to save tokens./compress
/settingsOpen the settings editor to configure language, theme, and more./settings
/summaryGenerate a project summary based on the conversation history./summary
/resumeResume a previous conversation session./resume
/statsDisplay detailed statistics for the current session./stats
/helpDisplay help information for available commands./help or /?
/quitExit Qwen Code./quit
For more advanced features of Qwen Code, see the Qwen Code official documentation.

Learn more

FAQ

Error codes

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

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.