OpenCode
Open-source coding, open-weight models.
Open-source terminal coding agent. Open source on top, open weights underneath, routed through Melious.
{
"$schema": "https://opencode.ai/config.json",
"model": "melious/<MODEL_ID>",
"small_model": "melious/<SMALL_MODEL_ID>",
"provider": {
"melious": {
"npm": "@ai-sdk/openai-compatible",
"name": "Melious",
"options": {
"baseURL": "https://api.melious.ai/v1",
"apiKey": "{env:MELIOUS_API_KEY}"
},
"models": {
"<MODEL_ID>": {
"name": "<Display Name>",
"limit": { "context": 128000, "output": 16384 }
}
}
}
}
}What is OpenCode?
OpenCode is an open-source terminal coding agent from the team behind SST. Model-agnostic, configured through a plain JSON file, and disciplined about tokens. Short prompts, minimal scratchpad chatter, no auto-summarization until it matters. Paired with Melious eco routing it's the cheapest way we've found to do serious agent work.
How to use OpenCode with Melious?
-
Install OpenCode
Run the official installer. macOS and Linux pull a small shell script. Windows uses npm.
Shell# macOS / Linux curl -fsSL https://opencode.ai/install | bash # Windows (requires Node.js) npm install -g opencode-ai -
Add Melious as a provider
Create
opencode.jsonin your project (or~/.config/opencode/config.jsonfor a global default). Themodelsmap is not auto-discovered from/v1/models. Add one entry per model you plan to use, or let the Melious CLI write the file for you on each launch. Browse melious.ai/hub/models for current IDs and context windows.opencode.json{ "$schema": "https://opencode.ai/config.json", "model": "melious/<MODEL_ID>", "small_model": "melious/<SMALL_MODEL_ID>", "provider": { "melious": { "npm": "@ai-sdk/openai-compatible", "name": "Melious", "options": { "baseURL": "https://api.melious.ai/v1", "apiKey": "{env:MELIOUS_API_KEY}" }, "models": { "<MODEL_ID>": { "name": "<Display Name>", "limit": { "context": 128000, "output": 16384 } } } } } } -
Run OpenCode
Export your Melious key, then launch. Every model is namespaced as
melious/<MODEL_ID>.Shellexport MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY> opencode
Three steps from here.
Grab a Melious key. Pick your tool. Follow the guide. Same client, now answering from Europe.