Terminal AI coding assistant
OpenCode is a terminal AI coding tool. Connect it to Qwen Cloud via Token Plan (Team Edition), Coding Plan, or pay-as-you-go billing.
Run the following command to verify the installation. The installation is successful if a version number is displayed.
Create and open the configuration file
Replace
Replace
Replace
After saving the configuration, restart OpenCode, type
If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:
Install OpenCode
- Install or update Node.js (v18.0 or later).
- Run the following command in the terminal to install OpenCode.
Configure access credentials
Create and open the configuration file opencode.json at one of the following paths:
- macOS / Linux:
~/.config/opencode/opencode.json - Windows:
C:\Users\<Your-Username>\.config\opencode\opencode.json
Token Plan (Team Edition)
Replace YOUR_API_KEY with the Token Plan (Team Edition) dedicated API Key. For available models, see Token Plan supported models.
Coding Plan
Replace YOUR_API_KEY with the Coding Plan dedicated API Key. For available models, see Coding Plan supported models.
Pay-as-you-go
Replace YOUR_API_KEY with the Qwen Cloud API Key. For available models, see Anthropic compatible API.
Verify configuration
After saving the configuration, restart OpenCode, type /models, search for Qwen Cloud, and select the model you want to use.
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