OpenCode
OpenCode is an open-source terminal AI coding assistant. OpenCode is configured via opencode.json (located in your project root or globally in ~/.config/opencode/opencode.json).
BotConnector provides an automated integration schema so you never have to manually add dozens of model definitions by hand.
---
1. Quick Setup: 1-Line Auto-Sync Command (Recommended)
Run the following command in your terminal inside your project directory (or where your opencode.json is located):
curl -s https://api.botconnector.id/v1/integrations | jq '{
"$schema": "https://opencode.ai/config.json",
"provider": {
"botconnector": {
"npm": "@ai-sdk/openai-compatible",
"name": "BotConnector",
"options": {
"baseURL": .base_url,
"apiKey": "{env:BOTCONNECTOR_API_KEY}"
},
"models": (.models | map({key: ., value: {name: .}}) | from_entries)
}
}
}' > opencode.jsonWhat does this command do?
- Queries the BotConnector integrations API (
GET /v1/integrations). - Dynamically maps all active BotConnector models (
agnes-3.0-flash,ling-3.0-flash,glm-5.3-flash,deepseek-v4-flash,mistral-medium-3.5-free, etc.) to the official OpenCode schema. - Writes the output directly to a valid
opencode.jsonfile ready for use.
Keeping Up-to-Date: Whenever BotConnector introduces new models or capacity adjustments, re-run the 1-line command to refresh your opencode.json instantly without manual editing.
---
2. Environment API Key Setup
OpenCode securely reads your API key from the BOTCONNECTOR_API_KEY environment variable. Export your key in your terminal:
export BOTCONNECTOR_API_KEY="bc_live_your_actual_api_key_here"To make it permanent across terminal sessions:
# Add to bashrc or zshrc
echo 'export BOTCONNECTOR_API_KEY="bc_live_your_actual_api_key_here"' >> ~/.bashrc
source ~/.bashrcCreate or view your API keys at Workspace → API Keys.
---
3. Complete opencode.json Reference
If you prefer to inspect or create opencode.json manually:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"botconnector": {
"npm": "@ai-sdk/openai-compatible",
"name": "BotConnector",
"options": {
"baseURL": "https://api.botconnector.id/v1",
"apiKey": "{env:BOTCONNECTOR_API_KEY}"
},
"models": {
"agnes-3.0-flash": { "name": "agnes-3.0-flash" },
"ling-3.0-flash": { "name": "ling-3.0-flash" },
"glm-5.3-flash": { "name": "glm-5.3-flash" },
"deepseek-v4-flash": { "name": "deepseek-v4-flash" },
"mistral-medium-3.5-free": { "name": "mistral-medium-3.5-free" },
"mistral-nemo": { "name": "mistral-nemo" },
"mimo-v2.5": { "name": "mimo-v2.5" },
"nemotron-3-nano-30b-a3b": { "name": "nemotron-3-nano-30b-a3b" },
"tencent-hy3": { "name": "tencent-hy3" },
"stealth/space-bunny-alpha": { "name": "stealth/space-bunny-alpha" }
}
}
}
}---
4. Running OpenCode
Once opencode.json is generated and BOTCONNECTOR_API_KEY is set, launch OpenCode:
opencodeUse the /model command or press Tab to switch between all available BotConnector models anytime.