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.
Launch Qwen Code and type
Launch Qwen Code and type
Launch Qwen Code and type
Launch Qwen Code and type
After configuration is complete, run the following command in your project directory to launch Qwen Code and start a conversation.
Qwen Code supports usage as a plugin in VS Code and JetBrains IDE, providing AI coding capabilities within the IDE.
Ensure your VS Code version is 1.85.0 or higher before use.
Ensure your JetBrains IDE supports Agent Client Protocol (ACP) before use.
For more advanced features of Qwen Code, see the Qwen Code official documentation.
If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:
Type the
Install Qwen Code
- macOS/Linux
- Windows
Open a terminal and run the following command to install Qwen Code.
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.
Advanced configuration: via settings.json
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
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.
Advanced configuration: via settings.json
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
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.
Advanced configuration: via settings.json
Advanced configuration: via settings.json
Edit or create a To add other models, append them in the same format within
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
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 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.
- 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.
JetBrains IDE
Ensure your JetBrains IDE supports Agent Client Protocol (ACP) before use.
- 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.
- Open JetBrains IDE, go to the AI Chat page, and click Install Plugin. IDEA will install the JetBrains AI Assistant plugin.
-
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/qwenwith the Qwen Code installation path. Run the following command to find the path:- macOS/Linux:
which qwen - Windows:
where qwen(CMD) orGet-Command qwen(PowerShell)
- macOS/Linux:
- 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.
| 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 |
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 and troubleshooting
- Coding Plan: Coding 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.