LMSupply.Generator
0.65.1
dotnet add package LMSupply.Generator --version 0.65.1
NuGet\Install-Package LMSupply.Generator -Version 0.65.1
<PackageReference Include="LMSupply.Generator" Version="0.65.1" />
<PackageVersion Include="LMSupply.Generator" Version="0.65.1" />
<PackageReference Include="LMSupply.Generator" />
paket add LMSupply.Generator --version 0.65.1
#r "nuget: LMSupply.Generator, 0.65.1"
#:package LMSupply.Generator@0.65.1
#addin nuget:?package=LMSupply.Generator&version=0.65.1
#tool nuget:?package=LMSupply.Generator&version=0.65.1
LMSupply.Generator
Local text generation and chat via GGUF (llama-server), with an optional ONNX Runtime GenAI backend.
Features
- Zero-config: Models download automatically from HuggingFace
- GPU Acceleration: CUDA, Vulkan, DirectML, CoreML, Metal
- GGUF Support: Load any GGUF model via llama-server (auto-downloaded)
- Server Pooling: Reuses llama-server instances for fast model switching
- MIT Models: Phi-4 and Phi-3.5 models with no usage restrictions
- Chat Support: Built-in chat formatters for various models
ONNX Runtime GenAI models
This package alone covers GGUF/llama-server. Loading an ONNX Runtime GenAI model (a
HuggingFace repo whose name or path indicates ONNX, or a local genai_config.json +
model.onnx directory) requires the separate LMSupply.Generator.Onnx package, registered
once at startup:
dotnet add package LMSupply.Generator.Onnx
LMSupply.Generator.Onnx.OnnxGeneratorBackend.Register();
Without it, loading an ONNX model throws a NotSupportedException naming the package. The
hardware-aware WithDefaultModel()/"auto" path is unaffected either way — it only ever
selects ONNX on a discrete non-NVIDIA Windows GPU, and only when this backend is registered;
otherwise it falls back to its GGUF selection, same as on any other hardware profile.
Quick Start
using LMSupply.Generator;
// Using the builder pattern
var generator = await TextGeneratorBuilder.Create()
.WithDefaultModel()
.BuildAsync();
// Generate text
string response = await generator.GenerateCompleteAsync("What is AI?");
Console.WriteLine(response);
await generator.DisposeAsync();
Downloading ahead of time
// Same resolution as LoadAsync (aliases, default/auto, repo ids), no model load:
var path = await LocalGenerator.DownloadModelAsync("gguf:gemma4-default");
Chat Completion
var messages = new[]
{
new ChatMessage(ChatRole.System, "You are a helpful assistant."),
new ChatMessage(ChatRole.User, "Explain quantum computing.")
};
string response = await generator.GenerateChatCompleteAsync(messages);
Available Models
| Model | Parameters | License | Description |
|---|---|---|---|
| Phi-4 Mini | 3.8B | MIT | Default, best balance |
| Phi-3.5 Mini | 3.8B | MIT | Fast, reliable |
| Phi-4 | 14B | MIT | Highest quality |
| Llama 3.2 1B | 1B | Conditional | Ultra-lightweight |
| Llama 3.2 3B | 3B | Conditional | Balanced |
GPU Acceleration
The GGUF/llama-server path auto-downloads the right llama-server binary for the detected GPU
(CUDA, Vulkan, Metal) — no extra NuGet package needed. GPU acceleration for ONNX Runtime GenAI
models is a LMSupply.Generator.Onnx concern; see that package's README.
Advanced GGUF Tuning
Fine-grained llama-server control (GPU offload, batch size, RoPE/YaRN scaling, KV cache
quantization, speculative decoding, LoRA, the startup wait policy — StartupStallTimeout /
StartupTimeout, progress-based rather than a fixed deadline — and more) is available via
LlamaOptions:
var generator = await TextGeneratorBuilder.Create()
.WithDefaultModel()
.WithLlamaOptions(new LlamaOptions
{
GpuLayerCount = -1,
AdditionalArgs = ["--verbose"], // raw llama-server CLI passthrough for flags not modeled above
})
.BuildAsync();
Pinning or pre-provisioning the llama-server binary
By default, the llama-server binary itself (not the model) is acquired from an unauthenticated,
unpinned GitHub Releases "latest" lookup on first use. For offline, air-gapped, or
security-reviewed deployments, ServerUpdateOptions lets a consumer take over that acquisition:
var generator = await TextGeneratorBuilder.Create()
.WithDefaultModel()
.WithServerUpdateOptions(new LlamaServerUpdateOptions
{
// Pin an exact release tag — a cache hit makes zero network calls; a cache miss downloads
// exactly this tagged asset instead of "latest". A pinned installation also never
// auto-checks for or applies a newer version.
PinnedVersion = "b7898",
// Or bypass acquisition entirely by pointing at an already-provisioned binary — takes
// precedence over PinnedVersion when both are set.
// ServerBinaryPath = "/opt/myapp/bin/llama-server",
})
.BuildAsync();
Reuse the same LlamaServerUpdateOptions instance across loads (rather than constructing a new one
each time) so they share one background-update timer and state file instead of each spawning its
own. EmbedderOptions.ServerUpdateOptions and RerankerOptions.ServerUpdateOptions follow the same
shape for the embedding and reranking GGUF paths.
An unpinned load starts on the cached build and fetches a newer one in the background for a later
load. UpdateOnWarmup = true makes each load check first and start on the newest build, at the cost of
waiting for the check (and the download, when there is one).
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- LMSupply.Core (>= 0.65.1)
- LMSupply.Llama (>= 0.65.1)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on LMSupply.Generator:
| Package | Downloads |
|---|---|
|
FluxIndex.Providers.LMSupply
LMSupply local AI embedding, reranking, and text completion provider for FluxIndex |
|
|
IronProw.LMSupply
iron-prow local-provider safety adapter: model-ID preflight, readiness gate, and length-bounding for lm-supply local inference. |
|
|
IronHive.Host
IronHive Host - reusable AI agent host SDK (agent loop, tools, session, provider integrations) for CLI, server, and embedded surfaces |
|
|
FileFlux.Providers.LMSupply
LMSupply local ONNX model provider for FileFlux: document analysis (summarization, metadata extraction), embeddings, OCR, and image captioning — no API key required. |
|
|
FluxImprover.LMSupply
LMSupply.Generator integration for FluxImprover - offline LLM text completion using local GGUF/ONNX models |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.65.1 | 184 | 9/13/2026 |
| 0.65.0 | 201 | 9/12/2026 |
| 0.64.0 | 110 | 9/11/2026 |
| 0.63.0 | 131 | 9/11/2026 |
| 0.62.0 | 150 | 9/10/2026 |
| 0.61.0 | 148 | 9/9/2026 |
| 0.60.0 | 113 | 9/9/2026 |
| 0.59.1 | 154 | 9/8/2026 |
| 0.59.0 | 138 | 9/8/2026 |
| 0.58.0 | 190 | 9/7/2026 |
| 0.57.0 | 162 | 9/7/2026 |
| 0.56.0 | 123 | 9/7/2026 |
| 0.55.5 | 118 | 9/7/2026 |
| 0.55.4 | 223 | 9/7/2026 |
| 0.55.0 | 213 | 9/5/2026 |
| 0.45.0 | 108 | 9/3/2026 |
| 0.44.0 | 112 | 9/3/2026 |
| 0.42.10 | 217 | 8/31/2026 |
| 0.42.5 | 114 | 8/29/2026 |
| 0.42.4 | 107 | 8/27/2026 |