---
title: A local LLM in GitHub Copilot (Rider)
date: 2026-08-07
tags: ai, llm, lm-studio, copilot, rider
summary: Connect LM Studio to GitHub Copilot in Rider, pick a model that fits, and watch out for the context window.
---

In the [last post](/p/2026-06-13-local-llm-lm-studio/) I set up LM Studio. Back then, Copilot in Rider could only talk to GitHub's servers. That has changed: you can now add your own model provider. Here is how I wired it up, and what tripped me up.

## Setup

1. Start LM Studio, load a model and turn on the local server. In the Developer tab, create an API key.
2. In Rider, open the Copilot **Language Models** dialog. It lists all the hosted models with their context window and cost. Click **+ Add Models...**.
3. First you create a custom endpoint provider: give it a name (I called mine `LocalLLM`), paste the API key and leave the API type on **Chat Completions**. LM Studio speaks that API.
4. Then add the model itself and fill in the dialog (my values below).

| Field | My value | Notes |
|---|---|---|
| Model ID | `qwen2.5-coder-1.5b-instruct` | Must match the model name in LM Studio |
| Deployment URL | `http://127.0.0.1:1234` | The address and port of the LM Studio server. 1234 is the default |
| Display name | `Qwen 2.5 Coder 1.5B` | What you see in the model picker |
| Max input tokens | `24000` | See the context window section |
| Max output tokens | `4000` | Same |
| Tool calling | ticked | Only tick what your model supports |
| Vision | not ticked | This model is text-only |

That's it. Copilot now talks to your own machine instead of the cloud.

**Tool calling and vision:** LM Studio shows what a model can do with small icons in the "Your Models" list. The eye means vision, the hammer means tool use. Check them before you tick the boxes in Rider, otherwise Copilot will try things the model can't do.

## Pick a model that fits

Don't load anything huge before checking. I use [willitrun.ai](https://willitrun.ai): enter your GPU and RAM, and it tells you whether a model fits and roughly how fast it will run. It beats downloading a 40 GB file and watching it crash.

This is what it says for my model on a laptop with an RTX 3050 Ti and 4 GB VRAM:

```ascii caption="Qwen 2.5 Coder 1.5B, Q4_K_M, RTX 3050 Ti Laptop 4 GB"
Fit status      Runs well
Decode          21 tok/s
First token     9.2 s
Safe context    33K
Memory          2.9 GB of 4.0 GB   (73% VRAM)
```

## The context window

This is the part that got me. Hosted models often work with around 400k tokens of context. My local setup has 32k at best. That is a big difference.

willitrun.ai shows the maximum context your hardware can handle for a model (33K for mine). Once you know that number, split it:

- Input: your prompt, the files and the instructions.
- Output: the answer. If you give everything to the input, the response gets cut off halfway.
- Buffer: some overhead is always used behind the scenes, so keep a bit free.

```ascii caption="my 32768 token budget (tokens)"
+-----------------------------+-----+------+
|            input            | out |buffer|
|            24000            |4000 | 4768 |
+-----------------------------+-----+------+
<-------------- 32768 tokens -------------->
```

## Setting it in two places

You have to set the context size in LM Studio when you load the model (Load tab, "Context Length"), and again in the Copilot model settings in Rider ("Max Input Tokens" and "Max Output Tokens"). In LM Studio mine is 32768, which is the most this model supports.

The annoying part: Copilot does not always respect the number you give it. Sometimes it ignores the setting and uses its own default. So if you set 24k and it still acts like it has more room, don't be surprised when the model runs out and crashes.

## Final thoughts

Local AI in the IDE feels great once it works. But the context gap between cloud and local models is real, so go easy on big files and long conversations. Small steps. And check willitrun.ai before you get your hopes up about a model your laptop can't handle.

This will probably change as local machines get more powerful.
