Skip to content

Run Qwen3.8-27B Locally With LM Studio and OpenCode

Run the open Qwen3.8-27B model locally in LM Studio and connect it to OpenCode on Windows.

MGMCSA Guru Team July 26, 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. 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.

Frequently asked questions

Can I run Qwen3.8-27B locally for OpenCode?

Yes. Use a compatible quantized build in LM Studio, start its OpenAI-compatible server, and connect OpenCode as a custom provider.

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?

A local quantization can be slower or less accurate than the hosted flagship. It is useful when privacy and local control matter more than maximum capability.

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.