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. In its model browser, search for a Qwen3-Coder model and pick a quantized variant that fits your hardware — LM Studio indicates whether a model will load given 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-coder-local": { "name": "Qwen3 Coder (local)" }
}
}
},
"model": "lmstudio/qwen3-coder-local"
}
Use the exact model ID LM Studio reports in the models map. Then run:
opencode
OpenCode now talks to your local Qwen3-Coder.
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
- OpenCode can’t connect — the LM Studio server isn’t started, or the port differs (check the Server tab).
- Model won’t load / very slow — too big for your hardware; pick a smaller quantization.
- Provider not found — the
providerkey must match themodelprefix. - Wrong model ID — copy the exact identifier LM Studio displays.
Local Qwen + OpenCode checklist
- LM Studio installed; Qwen3-Coder variant 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
Wrapping up
Running Qwen3-Coder locally with LM Studio and OpenCode gives you a private, no-cost coding agent with a friendly GUI for model management: download a fitting model, start LM Studio’s local server, and point OpenCode at localhost:1234/v1. The trade-off is honest — a local model is smaller and less capable than the hosted Qwen — so use it for privacy and routine work, and the cheap hosted API for big-context or hard tasks.
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.