OpenCode
Connect OpenCode to ShuYou and access Claude, GPT, and Gemini models from one terminal UI.
Prerequisites
- A modern terminal (Windows Terminal, iTerm2, etc.).
- A ShuYou API key from the console.
Step 1: Install OpenCode
curl -fsSL https://opencode.ai/install | bash
Or: brew install anomalyco/tap/opencodenpm i -g opencode-ai@latest
Register a custom provider:
- Select other in the provider list.
- Provider ID:
shuyou-anthropic (repeat for shuyou-openai / shuyou-google if needed).
- Token: any placeholder (the real key goes in
opencode.json).
Edit ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"shuyou-anthropic": {
"npm": "@ai-sdk/anthropic",
"name": "ShuYou Claude",
"options": {
"baseURL": "https://api.shuyou.ai",
"apiKey": "YOUR_SHUYOU_API_KEY"
},
"models": {
"anthropic/claude-sonnet-4.5": {
"name": "Claude Sonnet 4.5",
"modalities": { "input": ["text", "image"], "output": ["text"] }
}
}
},
"shuyou-openai": {
"npm": "@ai-sdk/openai",
"name": "ShuYou GPT",
"options": {
"baseURL": "https://api.shuyou.ai/v1",
"apiKey": "YOUR_SHUYOU_API_KEY"
},
"models": {
"openai/gpt-4o": {
"name": "GPT-4o",
"modalities": { "input": ["text", "image"], "output": ["text"] }
}
}
},
"shuyou-google": {
"npm": "@ai-sdk/google",
"name": "ShuYou Gemini",
"options": {
"baseURL": "https://api.shuyou.ai/v1beta",
"apiKey": "YOUR_SHUYOU_API_KEY"
},
"models": {
"google/gemini-3.1-pro-preview": {
"name": "Gemini 3.1 Pro",
"modalities": { "input": ["text", "image"], "output": ["text"] }
}
}
}
}
}
Replace YOUR_SHUYOU_API_KEY and add model slugs from the ShuYou model catalog.
Step 3: Verify
cd your-project-directory
opencode
In the TUI, run /models and select a ShuYou provider model.
FAQ
401 / 403: Check apiKey in opencode.json and model slugs on ShuYou.
Config path: ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\).
Switch models: Use /models inside OpenCode.
Use OpenCode only in project folders you trust. Validate JSON syntax before saving.