OpenCode
OpenCode is a CLI + TUI AI coding agent that runs in the terminal. By configuring it, you can connect to AI models on the Unisound Maas Platform through two access methods: pay-as-you-go and U Plan.
1. Preparation
Get configuration credentials
Two usage methods are supported, but the way to obtain the corresponding credentials differs.
- Base URL OpenAI-compatible protocol: https://maas-api.unisound.com/v1
- API Key
- Format: sk-xxxxx
Go to API Key Management to create an API Key
- Base URL OpenAI-compatible protocol: https://maas-api.unisound.com/v1
- API Key
- Format: tp-xxxxx
After subscribing successfully, go to Subscription Management to get the dedicated API Key
2. Install OpenCode
- Install Node.js (v18.0 or later).
- Run the following command in the terminal to install OpenCode
Install Command
npm install -g opencode-aiRun the following command to verify the installation. If a version number is returned, the installation was successful.
opencode -v3. Configure the U2-Flash model
1. Configure basic information
Edit or create the opencode.json configuration file at the following path:
- macOS/Linux: ~/.config/opencode/opencode.json
- Windows: <user directory>\.config\opencode\opencode.json
Copy the following content in full into the configuration file (replace UNISOUND_API_KEY as needed in actual use):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"unisound": {
"npm": "@ai-sdk/openai-compatible",
"name": "U2-Flash",
"options": {
"baseURL": "https://maas-api.unisound.com/v1",
"apiKey": "UNISOUND_API_KEY"
},
"models": {
"u2-flash": {
"name": "u2-flash"
}
}
}
}
}Use OpenCode CLI
After the configuration is complete, enter the project directory and run the following command to start OpenCode:
opencodeAfter startup, enter /models to view and switch the model in use.
4. Model Skill
We provide built-in U2-ASR, U2-TTS, U2-TTS-Clone, and U2-OCR capabilities. You only need to add the corresponding model Skill in OpenCode to quickly call these model services without integrating each model API separately.
Click the links below to open the corresponding Skill pages. You can install each Skill via chat or the command line. After installation, the Skill will guide you through configuring the related models.