Skip to content

Self-Hosted Coding Agent on Windows: Cline + Local Model

Build a fully self-hosted AI coding agent on Windows with Cline and a local model via Ollama or LM Studio. Private, no API cost, in VS Code — setup and trade-offs.

MGMCSA Guru Team August 11, 2026 4 min read
A self-hosted coding agent on Windows using Cline and a local model

For some work — confidential code, air-gapped environments, or simply not wanting your code on anyone’s server — a fully self-hosted coding agent is the answer. Run a model locally, connect the Cline extension in VS Code, and you have an in-editor AI agent that never sends a byte off your machine and costs nothing per token. This is how to build it on Windows.

For the cloud equivalent (cheaper to get good quality), see DeepSeek + Cline in VS Code.

The pieces

A self-hosted agent stack

Local server Ollama or LM Studio hosts the model
Model A coding model that fits your hardware
Agent UI Cline (VS Code) via OpenAI Compatible provider
Cost None per token — hardware + electricity only

Step 1: Host a local model

Pick a host:

Choose a coding-focused model that fits your hardware — a quantized Qwen3-Coder, a DeepSeek distill, or GLM-4.5-Air.

Step 2: Install Cline in VS Code

Install VS Code and the Cline extension from the marketplace. Cline runs on native Windows — no WSL required — and gives you an in-editor agent with plan-and-approve.

Step 3: Point Cline at your local server

In Cline’s settings, choose OpenAI Compatible and set the local endpoint:

Cline settings for a local model

API Provider OpenAI Compatible
Base URL http://localhost:11434/v1 (Ollama) or :1234/v1 (LM Studio)
API Key any value (e.g. local)
Model ID your local model's name

Save, and Cline runs entirely on your local model. Use Plan mode to keep the smaller model focused.

The honest trade-offs

A self-hosted agent wins decisively on privacy (nothing leaves your machine) and cost (no API bill). It loses on capability and speed: a model that fits consumer hardware is smaller than the top hosted models, so it’s weaker on hard tasks and slower than a cloud endpoint. That’s the deal — and for sensitive or offline work, it’s a deal worth taking.

When self-hosting is the right call

  • Confidential or regulated code that can’t go to a third party.
  • Air-gapped or offline environments.
  • Zero-API-cost requirements.
  • Learning and experimentation without bills.

If none of those apply, a cheap cloud model gives better results for very little money.

Troubleshooting

  • Cline can’t connect — the local server isn’t running, or the port is wrong.
  • Slow / out of memory — model too big; use a smaller quantization.
  • Weak results — expected for small local models; reserve hard tasks for cloud.
  • Model ID rejected — use the exact name your host reports.

Self-hosted agent checklist

  • Local server running (Ollama or LM Studio)
  • A coding model that fits your hardware loaded
  • Cline installed in VS Code
  • OpenAI Compatible provider pointed at the local URL
  • Plan mode used; hard tasks optionally sent to cloud

Wrapping up

A self-hosted coding agent on Windows is Cline plus a local model from Ollama or LM Studio: point Cline’s OpenAI Compatible provider at your local server and you have a private, zero-API-cost agent in VS Code. The honest trade-off is capability — local models are smaller — so it’s ideal for confidential, offline, or no-cost work, with a cheap cloud model in reserve for the hardest tasks.

For the local hosts, see DeepSeek with Ollama and Qwen3-Coder with LM Studio.

Frequently asked questions

Can I run a fully self-hosted, private coding agent on Windows?

Yes. Run a local model with Ollama or LM Studio, then point the Cline VS Code extension at its OpenAI-compatible endpoint. Your code and prompts never leave your machine, and there's no API cost — just hardware and electricity.

Which local model should I use?

A coding-focused model that fits your hardware — a quantized Qwen3-Coder, DeepSeek distill, or GLM-4.5-Air. Pick the largest your GPU/RAM can run smoothly. Bigger is better for quality, but only if it runs at a usable speed.

Is a self-hosted agent as good as a cloud one?

No — local models that fit consumer hardware are smaller and less capable than top hosted models. The win is privacy and zero cost. For sensitive code or offline work it's ideal; for the hardest tasks, a cheap cloud model is stronger.

Why Cline for this?

Cline is a free VS Code extension with an OpenAI Compatible provider, so it connects to any local server in a couple of settings. You get an in-editor agent — plan, approve, edit — entirely on local infrastructure.

Do I need WSL?

Not necessarily. Ollama and LM Studio run on native Windows, and Cline is a VS Code extension that runs natively too. WSL is optional; native Windows is the simplest fully-local setup.

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.