OpenCode on Starsg
OpenCode is an open-source terminal / editor coding assistant that natively supports a baseURL and apiKey per provider. Point all three providers (Claude / GPT / Gemini) at Starsg and you get one key, one usage view and one tool to drive them all.
1. Install OpenCode
Install globally via npm. Requires Node.js 18+.
npm i -g opencode-ai
Run opencode once after install so it can scaffold the default config directory. Hit Ctrl+C as soon as the welcome screen shows up.
opencode
2. Edit opencode.json
Generate an API Key in the Starsg console, then replace all three sk-abc...xyz placeholders below with that key. Keep the model names exactly as each provider expects — only the baseURL changes.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"apiKey": "sk-abc...xyz",
"baseURL": "https://api.starsg.ai"
}
},
"openai": {
"options": {
"apiKey": "sk-abc...xyz",
"baseURL": "https://api.starsg.ai/v1"
}
},
"google": {
"options": {
"apiKey": "sk-abc...xyz",
"baseURL": "https://api.starsg.ai"
}
}
}
}3. Move it into OpenCode's config directory
macOS — open the config folder from your terminal:
open "$HOME/.config/opencode"
Windows — open the config folder from cmd:
start "" "%USERPROFILE%\.config\opencode"
Drop the edited opencode.json into this folder, overwriting the existing one. If the bundle you downloaded ships a plugins/ directory, copy that in too.
4. Verify
Launch opencode again and type /models inside the interactive prompt. Seeing models from anthropic, openai and google means you're set.
opencode # In the interactive UI, type: /models