LmsSharp.Hosting 1.0.5

dotnet add package LmsSharp.Hosting --version 1.0.5
                    
NuGet\Install-Package LmsSharp.Hosting -Version 1.0.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LmsSharp.Hosting" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LmsSharp.Hosting" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="LmsSharp.Hosting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LmsSharp.Hosting --version 1.0.5
                    
#r "nuget: LmsSharp.Hosting, 1.0.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LmsSharp.Hosting@1.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LmsSharp.Hosting&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=LmsSharp.Hosting&version=1.0.5
                    
Install as a Cake Tool

logo.png

Lightweight hosting and DI helpers for integrating LM Studio into .NET apps. Wraps the LmsSharp client with convenient services and a BackgroundService for health checks, chat, streaming, structured output, and tool use.

NuGet License: MIT

Installation

From Source

Build the project locally:

git clone https://github.com/Ddemon26/Lmss.git
cd Lmss/Lmss.Hosting
dotnet build

NuGet Package

dotnet add package LmsSharp.Hosting

Local Development

Reference the project directly in your .csproj:

<ProjectReference Include="path/to/Lmss.Hosting/Lmss.Hosting.csproj" />

Requirements

  • .NET 8.0
  • LM Studio running locally (default: http://localhost:1234)

Quick Start

Option 1: One‑liner factory

using Lmss.Hosting;

var service = ServiceFactory.Create();
var reply = await service.SendMessageAsync("Hello LM Studio!");
Console.WriteLine(reply);

Option 2: Dependency Injection (service helper)

using Lmss.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        // Registers ILmss + LmssService and optional settings
        services.AddService(opts =>
        {
            // Example: configure base URL or model
            // opts.BaseUrl = "http://localhost:1234";
            // opts.DefaultModel = "your-model-name";
        });
    })
    .Build();

await host.StartAsync();

var svc = host.Services.GetRequiredService<LmssService>();
var response = await svc.SendMessageAsync("Hi there!");
Console.WriteLine(response);

await host.StopAsync();

Option 3: Background service

The package includes LmssHostedService, which continuously monitors readiness and can be extended for custom workflows.

using Lmss.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        // Registers ILmss and the background hosted service
        services.AddHostedService(opts =>
        {
            // opts.BaseUrl = "http://localhost:1234";
        });
    })
    .Build();

await host.RunAsync();

To customize periodic background work, subclass LmssHostedService and override OnBackgroundExecuteAsync.

Features

  • Dependency injection: AddClient, AddService, AddHostedService
  • Background processing with readiness checks and logging
  • Chat completions (simple and streaming)
  • Structured JSON output using schemas
  • Tool use/function calling workflow
  • Model management and health checks

Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

License

This project is licensed under the MIT License — see the LICENSE file for details.

Support

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 106 9/6/2025
1.0.4 135 9/2/2025
1.0.3 123 9/2/2025