If you want a local coding model without touching the command line to host it, LM Studio is the friendliest route on Windows: a desktop app that downloads models, runs them, and serves an OpenAI-compatible endpoint with a few clicks. Pair it with OpenCode and you’ve got a private, no-API-cost coding agent running entirely on your machine.
This is the LM Studio + OpenCode + Qwen3-Coder setup. For the cheap hosted alternative, see run Qwen3-Coder with Claude Code.
Step 1: Install LM Studio and download Qwen3-Coder
Install LM Studio for Windows. Search for Qwen3.8-27B and choose a quantized build that cites the official Qwen release. LM Studio estimates whether it fits your VRAM and RAM.
Step 2: Start the local server
In LM Studio, load the model and start its local server (the Developer/Server tab). It exposes an OpenAI-compatible endpoint, commonly at http://localhost:1234/v1. Note the model identifier LM Studio shows for the loaded model.
Step 3: Connect OpenCode
Add LM Studio as a custom provider in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio",
"options": {
"baseURL": "http://localhost:1234/v1",
"apiKey": "lm-studio"
},
"models": {
"qwen3.8-27b-local": { "name": "Qwen3.8 27B (local)" }
}
}
},
"model": "lmstudio/qwen3.8-27b-local"
}
Use the exact model ID LM Studio reports in the models map. Then run:
opencode
OpenCode now uses the model loaded in LM Studio. Replace the example ID with the exact identifier shown by the local server.
The honest trade-offs
Local Qwen vs hosted Qwen (DashScope)
| Cost | Local: free to run · Hosted: cheap pay-per-token / plan |
|---|---|
| Privacy | Local: fully private · Hosted: sent to provider |
| Quality | Local: lower (smaller model) · Hosted: full model + big context |
| Context | Local: limited by RAM · Hosted: very large window |
A local model is smaller than the hosted Qwen3-Coder and can’t match its huge context window, so quality and context are lower. Local wins on privacy and zero cost. For big-context or hard tasks, the hosted DashScope route is cheap and far more capable.
Troubleshooting
- If OpenCode cannot connect, start LM Studio’s server and confirm its port.
- If the model will not load, select a smaller quantization.
- If the provider is missing, make sure the provider key matches the model prefix.
- If the model ID fails, copy the identifier displayed by LM Studio.
Local Qwen + OpenCode checklist
- LM Studio installed; Qwen3.8-27B quantization downloaded
- Model size confirmed to fit your hardware
- LM Studio local server started (note the URL/port)
- OpenCode provider pointed at localhost:1234/v1
- Hard/big-context tasks optionally sent to hosted Qwen
Verify the local model
Start the local server, ask OpenCode to read one file, and confirm in LM Studio that the request reached Qwen3.8-27B. Use the hosted Qwen3.8-Max service when the local quantization is too slow or the task needs more context.
For the CLI-based local route, see run DeepSeek locally with Ollama; for a local model in VS Code, self-hosted coding agent with Cline.