LMStudio for .NET
A small .NET library for chatting with a local language model through LM Studio. My first NuGet package: 1,000+ downloads.

The problem
In 2024 I wanted to call a local language model from C#, without pulling in a large SDK.
What I built
A chat class that keeps the conversation history and talks to LM Studio’s local server, using only HttpClient and System.Text.Json. Because it follows the OpenAI chat format, it works with any server that speaks it. Four releases in three weeks, MIT-licensed, with no dependencies.
var connection = new ModelConnection(
"http://localhost:1234/v1/", "llama-3-8b-instruct");
var chat = new Chat(connection, "You're a helpful assistant.");
string answer = await chat.CreateChatCompletion(
"What is dependency injection?");What I’d do differently
- Version 1.2 made the main call synchronous. That’s a breaking change in a minor version, and
.Resultcan deadlock in UI and ASP.NET code. - The
apiKeyparameter is accepted but never sent. - A library shouldn’t write to the console; it should log through
ILogger, or not at all. - The code of the later releases was never pushed, so the repository is behind the package.
- No streaming, no cancellation, and a new
HttpClientper connection instead of a factory.
Status
No longer maintained. It has 1,000+ downloads on NuGet; that count includes mirrors and CI restores, so it isn’t a user count. The code is on GitHub.