Skip to content

Run Qwen3-Coder Locally With LM Studio + OpenCode

Run Qwen3-Coder locally with LM Studio on Windows and connect it to OpenCode. Model download, the local server, config, hardware needs, and the common fixes.

MGMCSA Guru Team August 9, 2026 3 min read
Qwen3-Coder running locally in LM Studio connected to OpenCode on Windows

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 provider key must match the model prefix.
  • 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.

Frequently asked questions

Can I run Qwen3-Coder locally for OpenCode?

Yes. LM Studio downloads and serves Qwen3-Coder (in a size that fits your hardware) on a local OpenAI-compatible endpoint, and OpenCode connects to it as a custom provider. Everything runs on your machine with no API cost.

What does LM Studio do?

LM Studio is a desktop app that downloads GGUF models, runs them locally, and exposes an OpenAI-compatible server. It's a friendly way to host a local model on Windows without command-line setup, with a GUI for picking and loading models.

What hardware do I need?

It depends on the model size and quantization. Smaller quantized Qwen3-Coder variants run on consumer GPUs or strong CPUs; larger ones need more VRAM/RAM. LM Studio shows whether a model will fit before you load it.

Is local Qwen as good as the DashScope API?

Usually not — a local-sized model is smaller than the full hosted Qwen3-Coder, so quality is lower. Local wins on privacy and zero cost, not top-end capability. Use the hosted API for the hardest tasks.

How does OpenCode connect to LM Studio?

Add a custom provider in opencode.json with LM Studio's local server URL (commonly http://localhost:1234/v1) and the loaded model's ID. OpenCode then routes to your local model.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.