Aspose.LLM 26.11.0

Prefix Reserved
dotnet add package Aspose.LLM --version 26.11.0
                    
NuGet\Install-Package Aspose.LLM -Version 26.11.0
                    
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="Aspose.LLM" Version="26.11.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspose.LLM" Version="26.11.0" />
                    
Directory.Packages.props
<PackageReference Include="Aspose.LLM" />
                    
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 Aspose.LLM --version 26.11.0
                    
#r "nuget: Aspose.LLM, 26.11.0"
                    
#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 Aspose.LLM@26.11.0
                    
#: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=Aspose.LLM&version=26.11.0
                    
Install as a Cake Addin
#tool nuget:?package=Aspose.LLM&version=26.11.0
                    
Install as a Cake Tool

Aspose.LLM for .NET

NuGet Version NuGet Downloads .NET Standard 2.0

Aspose.LLM for .NET is a local LLM inference library for C# and .NET. Use it to run large language models on your own machine or server, build chat-driven workflows, send image input with vision presets, and keep prompts, model weights, and responses inside your own process instead of calling a hosted inference service.

The SDK targets netstandard2.0, works across modern .NET runtimes, and uses built-in presets for model families such as Qwen, Gemma, Llama, Phi, DeepSeek, and vision-capable variants. Native llama.cpp runtimes for CPU, CUDA, HIP, Metal, and Vulkan are downloaded automatically on first use.

No built-in LLM is included in Aspose.LLM. A preset is configuration only: you choose which open-source model to use, and the model file is obtained separately on your own machine, under the model publisher's license, not the Aspose license. Model names are used solely to identify the models, with no affiliation or endorsement implied; each name remains the property of its owner.

Why Aspose.LLM for .NET

  • Run local LLM inference from .NET applications on CPU or GPU.
  • Start stateful chat sessions with message history and session persistence.
  • Use built-in text and vision presets instead of hand-building inference pipelines.
  • Send text-only or multimodal prompts through one high-level AsposeLLMApi.
  • Tune context, sampling, acceleration, and runtime behavior through parameter bags.
  • Bring your own GGUF model by extending PresetCoreBase or overriding preset settings.

How It Works

  1. Choose a preset for a text or vision model family.
  2. Create a single AsposeLLMApi instance for the current process.
  3. Let the SDK resolve native llama.cpp runtime assets for your platform.
  4. Send prompts through SendMessageAsync, optionally with image bytes for multimodal requests.
  5. Persist or reuse chat sessions when you need multi-turn conversations.

Supported Environment

Area Details
Managed package target netstandard2.0
Common runtimes .NET 10, .NET 8 LTS, .NET 6, and .NET Framework 4.7.2+
Acceleration backends CPU, CUDA, HIP / ROCm, Metal, Vulkan
First-run native download Usually 100-500 MB, depending on the selected backend
Package shape One NuGet package, one main assembly: Aspose.LLM.dll
Model setup Built-in presets for text and vision models, plus custom preset support

Install from NuGet

dotnet add package Aspose.LLM

Apply a license before calling chat APIs. Aspose.LLM does not run inference in evaluation mode, so a temporary or commercial license is required for StartNewChatAsync, SendMessageAsync, and SendMessageToSessionAsync.

Choose a Preset

  • Qwen25Preset for general text chat and local assistant workflows.
  • Qwen3Preset for text reasoning and chat-oriented workloads.
  • Qwen25VL3BPreset for image + text multimodal prompts.
  • Qwen3VL2BPreset for larger-context vision scenarios.
  • Gemma3VisionPreset for vision-enabled Gemma workflows.
  • CPU variants such as Qwen25_3BPresetCpu or Llm32_1BPresetCpu when GPU acceleration is unavailable.

Text Chat Example

using Aspose.LLM;
using Aspose.LLM.Abstractions.Parameters.Presets;

var license = new License();
license.SetLicense("Aspose.LLM.lic");

using var api = AsposeLLMApi.Create(new Qwen25Preset());

string response = await api.SendMessageAsync(
    "Explain retrieval-augmented generation in two sentences.");

Console.WriteLine(response);

Multimodal Vision Example

using Aspose.LLM;
using Aspose.LLM.Abstractions.Parameters.Presets;
using System.IO;

var license = new License();
license.SetLicense(@"C:\licenses\Aspose.LLM.lic");

using var api = AsposeLLMApi.Create(new Qwen25VL3BPreset());

byte[] imageBytes = File.ReadAllBytes(@"C:\images\sample.png");

string response = await api.SendMessageAsync(
    "Describe what is shown in the image.",
    media: new[] { imageBytes });

Console.WriteLine(response);

Session Lifecycle and Memory Cleanup

SendMessageAsync is conversation-oriented. The first call creates a chat session when no session is active; later calls reuse that active session and append to its history. The session is not closed automatically.

For independent one-shot prompts, close the session when the response is no longer needed:

string sessionId = await api.StartNewChatAsync();
string response = await api.SendMessageToSessionAsync(sessionId, prompt);
api.CloseChatSession(sessionId);

ForceCacheCleanup(...) prunes the KV cache inside the active session, but it does not destroy the session's native context. Use CloseChatSession(sessionId) to release per-session native context memory, and dispose AsposeLLMApi when the loaded model itself is no longer needed.

Control Cache Directories

When a preset leaves cache paths at their built-in defaults, the SDK can take the cache roots from environment variables:

  • ASPOSE_LLM_MODEL_CACHE_DIR
  • ASPOSE_LLM_RUNTIME_CACHE_DIR

Precedence is:

  1. preset path
  2. environment variable
  3. built-in default

Built-in defaults are under the local application data directory:

  • models: Aspose.LLM/models
  • runtimes: Aspose.LLM/runtimes

Load Presets From JSON

AsposeLLMApi.LoadPresetFromJson(...) loads one preset from one inline JSON document. The JSON must contain extends, which selects the built-in preset used as the base. Any other provided sections override that base preset.

var preset = AsposeLLMApi.LoadPresetFromJson("""
{
  "extends": "Qwen25Preset",
  "contextParameters": {
    "contextSize": 8192
  },
  "samplerParameters": {
    "temperature": 0.2
  }
}
""");

using var api = AsposeLLMApi.Create(preset);

AsposeLLMApi.SavePresetToJson(...) exports a built-in preset back to the same contract, so a user can tweak a working preset in code and then export an exact JSON example:

var preset = new Qwen25Preset();
preset.ContextParameters.ContextSize = 8192;
preset.SamplerParameters.Temperature = 0.2f;

string json = AsposeLLMApi.SavePresetToJson(preset);
Console.WriteLine(json);

If you want a full preset snapshot instead of only overrides, pass includeDefaults: true:

string fullJson = AsposeLLMApi.SavePresetToJson(preset, includeDefaults: true);
Console.WriteLine(fullJson);

Customize a Preset

using Aspose.LLM.Abstractions.Parameters.Presets;

var preset = new Qwen25Preset();
preset.BinaryManagerParameters.ReleaseTag = "b10988";
preset.ContextParameters.ContextSize = 8192;

using var api = AsposeLLMApi.Create(preset);

Use this pattern when you want to keep the model-family defaults but adjust runtime tag, context window, batching, or acceleration preferences for a specific deployment.

Common Use Cases

  • Local AI assistants and chatbots for .NET applications.
  • Document automation, classification, and question answering workflows.
  • Code generation and code analysis scenarios.
  • Multimodal vision Q&A with text and images.
  • Offline or controlled-deployment AI integrations where data should stay local.

Before First Run

  • Apply a temporary or commercial license before starting a chat session.
  • Expect an automatic native runtime download on the first launch for the selected backend.
  • Plan local disk space for runtime assets, model weights, and chat-session state if you persist sessions.
  • Keep your first validation scenario small, then move to larger presets or larger context windows.

Important Notes

  • First use downloads the matching native llama.cpp runtime for your platform and acceleration backend.
  • AsposeLLMApi allows only one active instance per process at a time.
  • Presets are the recommended entry point for model selection, sampler defaults, context size, and acceleration behavior.
  • Vision support uses the same API surface as text chat and adds media input through the media parameter.

Resources

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Aspose.LLM:

Package Downloads
Aspose.Total

Aspose.Total for .NET is the most complete package of all .NET file format APIs offered by Aspose. It empowers developers to create, edit, render, print and convert between a wide range of popular document formats within any .NET, C#, ASP.NET and VB.NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.11.0 114 11/6/2026
26.6.0 3,445 6/25/2026
26.5.0 316 5/25/2026
26.4.0 3,683 4/29/2026
26.3.0 2,254 3/25/2026
26.2.0 168 3/3/2026

Updated the llama.cpp runtime to b10988 and added .NET 10 support.