Terminal AI coding assistant
Connect it to QwenCloud via Token Plan (Individual), Token Plan (Team Edition), or pay-as-you-go billing.
Run the following command to verify the installation. The installation is successful if a version number is displayed.
In addition to the options above, you can also connect using a configuration file.
After saving the configuration, restart OpenCode, type
If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:
Upgrade OpenCode to the latest version, then check
The API key does not match the selected provider, or the key belongs to another billing plan. Run
When using qwen4-max-preview, the default output limit is 32000; to allow longer output, set
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX.Install OpenCode
- Install or update Node.js (v18.0 or later).
- Run the following command in the terminal to install OpenCode.
Quick Start
1
Connect the provider
Run
opencode, enter /connect, select the provider for your billing plan, and enter the API key:- Token Plan
- Pay-as-you-go
Select Alibaba Token Plan (China) and enter the Token Plan API key for your edition:
- Token Plan Individual: Create or view API Key
- Token Plan Team Edition: Assign a seat and get the API Key
2
Select a model
Enter
/models and select the model you want.3
Verify
Run the following command to verify:
Configure access credentials
In addition to the options above, you can also connect using a configuration file.
1
Open or create the configuration file
- macOS / Linux:
~/.config/opencode/opencode.json - Windows:
C:\Users\<Your-Username>\.config\opencode\opencode.json
2
Write the configuration
Replace
YOUR_API_KEY with the API key for your plan.- Token Plan Individual
- Token Plan Team Edition
- Pay-as-you-go
Verify configuration
After saving the configuration, restart OpenCode, type /models, search for QwenCloud, 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
- Token Plan: Token Plan FAQ
The model I need is not in the list
Upgrade OpenCode to the latest version, then check /models again. If the model is still missing, define a custom provider in opencode.json and add the model.
Requests return 401 Unauthorized
The API key does not match the selected provider, or the key belongs to another billing plan. Run /connect again, select the provider for your plan, and enter the correct key.