Use MagmaRouter in OpenCode

OpenCode defines providers in opencode.json using the AI SDK provider packages. Add MagmaRouter with the openai-compatible package and point it at the /v1 base URL.
- Base URL
- https://api.magmarouter.com/v1
- API key
- Get one, starts sk-mr-
- Example model
- glm-5.3-xploded
Add a provider in opencode.json
In ~/.config/opencode/opencode.json or a project opencode.json:
JSON
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"magmarouter": {
"npm": "@ai-sdk/openai-compatible",
"name": "MagmaRouter",
"options": {
"baseURL": "https://api.magmarouter.com/v1",
"apiKey": "{env:MAGMAROUTER_API_KEY}"
},
"models": {
"glm-5.3-xploded": {
"name": "GLM 5.3 Flash Xploded",
"limit": { "context": 1048576, "output": 8192 }
}
}
}
},
"model": "magmarouter/glm-5.3-xploded",
"small_model": "magmarouter/glm-5.3-xploded"
}Set the real context and output limits from the model's catalogue page. For an agent that edits files, choose a tool-capable model. You can also run /connect in OpenCode, choose Other, and paste the key against a provider id of magmarouter.
Pick a model
Each page has the OpenCode setup with that model's id and limits filled in, and what a session costs.
GLM 5.3 Xploded in OpenCode1M context, $2.00 in / $5.00 out per 1M
GLM 5.3 Flash Xploded in OpenCode1M context, $0.30 in / $1.00 out per 1M
DeepSeek V4.1 Flash 1017 Xploded in OpenCode1M context, $1.25 in / $2.50 out per 1M
DeepSeek Flash Lite Xploded in OpenCode512K context, $0.36 in / $1.44 out per 1M
MiMo V2.6 Flash Xploded in OpenCode1M context, $1.00 in / $2.00 out per 1M
Qwen3.8 27B Xploded in OpenCode1M context, $1.50 in / $5.00 out per 1M
Qwen3.8 27B Ultrafast Xploded in OpenCode524K context, $1.75 in / $5.50 out per 1M