MerchantryTidbits

llm-inference / library

OllamaSharp

Capability: OllamaSharp

Use it when

  • You are building a C# or .NET application that must chat with local Ollama models with streamed responses and tracked conversation history
  • You need model management from .NET, such as listing, pulling with progress, or deleting Ollama models, or an IChatClient and IEmbeddingGenerator implementation for Microsoft.Extensions.AI

What it solves

Not the fit when

  • Non-.NET stacks; this is a C# library only
  • It is not a model runtime; a running Ollama server is required
  • Per the README, prefer Microsoft.Extensions.AI abstractions if you need to swap between providers like OpenAI and Claude, or Semantic Kernel for agentic systems
  • running model inference itself
  • multi provider llm routing
  • python or javascript llm clients
  • prompt evaluation and testing

Install

Install the OllamaSharp NuGet package (dotnet add package OllamaSharp); requires a running Ollama instance, local or remote

Invoke

C#: var ollama = new OllamaApiClient(new Uri("http://localhost:11434")); ollama.SelectedModel = "qwen3.5:35b-a3b"; await foreach (var s in ollama.GenerateAsync("...")) Console.Write(s.Response); or use the Chat class for multi-turn history

Alternatives

No reviewed alternatives recorded yet.