OpenCode v2: Local AI Provider Config
In my AI stack post I showed how all my tools point at a single gateway with workspace model aliases. OpenCode v2 changed how local providers are configured, so here’s my updated ~/.config/opencode/opencode.json.
The Config
{
"$schema": "https://opencode.ai/config.json",
"model": "rush-ai/glm-5.3-flash",
"provider": {
"rush-ai": {
"npm": "@ai-sdk/openai-compatible",
"name": "Rush AI",
"options": {
"baseURL": "https://llm.mywebsite.com/api/v1",
"apiKey": "sk-MY-SECRET-TOKEN"
},
"models": {
"glm-5.3-flash": {
"name": "glm-5.3-flash",
"tool_call": true,
"reasoning": true,
"limit": { "context": 500000, "output": 131072 },
"variants": {
"low": { "reasoningEffort": "low" },
"high": { "reasoningEffort": "high" },
"max": { "reasoningEffort": "max" }
}
},
"qwen3.8:27b": {
"name": "qwen3.8:27b",
"tool_call": true,
"limit": { "context": 262144, "output": 131072 },
"variants": {
"low": { "reasoningEffort": "low" },
"medium": { "reasoningEffort": "medium" },
"xhigh": { "reasoningEffort": "xhigh" }
}
}
}
}
},
"agent": {
"build": { "options": { "temperature": 0.7 } },
"plan": { "options": { "temperature": 0.9 } }
}
}
What’s New in v2
npmfield — providers are now explicit packages;@ai-sdk/openai-compatibleis the one for local/self-hosted OpenAI-compatible endpoints- Per-model capabilities — declare
tool_call,reasoning, and context/outputlimitright in the config instead of relying on the gateway to advertise them - Variants — one model entry exposes multiple
reasoningEffortlevels, switchable per request. Different models can expose different sets:glm-5.3-flashgetslow/high/max, while the smallerqwen3.8:27bgetslow/medium/xhigh - Per-agent tuning —
temperatureand other sampling options are now configurable per agent
Tuning Temperature per Agent
In addition I now specifiy temperature. Coding agents do two very different jobs, and one temperature doesn’t fit both. The build agent writes code all day, so I keep it at 0.7 — deterministic enough that repeated edits stay consistent. The plan agent is where I want creative range: exploring approaches, weighing trade-offs, questioning assumptions. Bumping it to 0.9 gives the planning phase even more diversity of thought without letting outputs wander. Small numbers, but they meaningfully change the character of each agent.
Still the same architecture underneath: OpenCode points at the rush-ai provider on the gateway, and the gateway routes to whatever backend is serving the model. If you want the full picture — Traefik, OWUI, vLLM on the DGX Sparks — read the unified gateway post.