OpenCode Integration Guide
OpenCode is a CLI + TUI AI programming agent tool that runs in the terminal. It also provides IDE plugin integration, capable of completing tasks such as rapid code generation, debugging, project analysis, and file operations.
1. Obtain API Key
- Refer to Model Activation Help Documentation
2. Install OpenCode
After installing OpenCode, you can directly use the
opencodecommand in the terminal to launch the interactive interface.
Prerequisite: Node.js 18.0 or higher version
1: Install OpenCode
npm install -g opencode-ai2: Verify Installation
opencode -v
3. Configure Access Credentials
The configuration file path depends on the operating system. Please ensure the path is correct, otherwise the configuration will not take effect.
1: Create Configuration File
- macOS / Linux:
~/.config/opencode/opencode.json - Windows:
C:\Users\用户名\.config\opencode\opencode.json
2: Fill in Configuration Content
Replace <YOUR_API_KEY> with your API key, and <OPENAI_API_MODEL> with the model name:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"EazyDevelop": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "https://api-maas.eazytec-cloud.com/v1",
"apiKey": "<YOUR_API_KEY>",
"setCacheKey": true
},
"models": {
"<OPENAI_API_MODEL>": {
"name": "<OPENAI_API_MODEL>"
}
}
}
}
}4. Verify Configuration
After saving the configuration, run the command opencode, restart OpenCode, enter /models, and select the configured model to start the conversation.

Notes
- Do not make mistakes with the configuration file path. You can check the home directory path using
echo $HOME - You need to restart OpenCode after saving the configuration for it to take effect
- Enter
/modelsto switch between different models