CommunityToolkit.Aspire.OllamaSharp 13.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.OllamaSharp --version 13.0.0
                    
NuGet\Install-Package CommunityToolkit.Aspire.OllamaSharp -Version 13.0.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="CommunityToolkit.Aspire.OllamaSharp" Version="13.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.OllamaSharp" Version="13.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.OllamaSharp" />
                    
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 CommunityToolkit.Aspire.OllamaSharp --version 13.0.0
                    
#r "nuget: CommunityToolkit.Aspire.OllamaSharp, 13.0.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 CommunityToolkit.Aspire.OllamaSharp@13.0.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=CommunityToolkit.Aspire.OllamaSharp&version=13.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.OllamaSharp&version=13.0.0
                    
Install as a Cake Tool

CommunityToolkit.Aspire.OllamaSharp library

Registers IOllamaApiClient in the DI container to interact with the Ollama API and optionally supports registering an IChatClient or IEmbeddingGenerator from Microsoft.Extensions.AI.

Getting Started

Prerequisites

  • Ollama HTTP(S) endpoint

Install the package

Install the .NET Aspire OllamaSharp library using the following command:

dotnet add package CommunityToolkit.Aspire.OllamaSharp

Example usage

In the Program.cs file of your project, call the AddOllamaApiClient extension method to register the IOllamaApiClient in the DI container. This method takes the connection name as a parameter:

builder.AddOllamaApiClient("ollama");

Then, in your service, inject IOllamaApiClient and use it to interact with the Ollama API:

public class MyService(IOllamaApiClient ollamaApiClient)
{
    // ...
}
Integration with Microsoft.Extensions.AI

To use the integration with Microsoft.Extensions.AI, call the AddOllamaSharpChatClient or AddOllamaSharpEmbeddingGenerator extension method in the Program.cs file of your project. These methods take the connection name as a parameter, just as AddOllamaApiClient does, and will register the IOllamaApiClient, as well as the IChatClient or IEmbeddingGenerator in the DI container. The IEmbeddingsGenerator is registered with the generic arguments of <string, Embedding<float>>.

Configuring OpenTelemetry

When using the chat client integration, you can optionally configure the OpenTelemetry chat client to control telemetry behavior such as enabling sensitive data:

builder.AddOllamaApiClient("ollama")
    .AddChatClient(otel => otel.EnableSensitiveData = true);

The integration automatically registers the Microsoft.Extensions.AI telemetry source (Experimental.Microsoft.Extensions.AI) with OpenTelemetry for distributed tracing.

Additional documentation

Feedback & contributing

https://github.com/CommunityToolkit/Aspire

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 is compatible.  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 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. 
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 (4)

Showing the top 4 popular GitHub repositories that depend on CommunityToolkit.Aspire.OllamaSharp:

Repository Stars
dotnet/eShop
A reference .NET application implementing an eCommerce site
dotnet/extensions
This repository contains a suite of libraries that provide facilities commonly needed when creating production-ready applications.
foxminchan/BookWorm
The practical implementation of Aspire using Microservices, AI-Agents
davidfowl/aspire-ai-chat-demo
Aspire AI Chat is a full-stack chat sample that combines modern technologies to deliver a ChatGPT-like experience.
Version Downloads Last Updated
13.0.1-beta.486 22 1/12/2026
13.0.1-beta.468 1,340 12/3/2025
13.0.1-beta.467 618 12/3/2025
13.0.0 5,817 11/25/2025
13.0.0-beta.462 143 11/25/2025
13.0.0-beta.456 184 11/23/2025
13.0.0-beta.454 97 11/23/2025
13.0.0-beta.453 114 11/22/2025
13.0.0-beta.450 123 11/22/2025
13.0.0-beta.448 119 11/22/2025
13.0.0-beta.444 979 11/17/2025
13.0.0-beta.443 276 11/17/2025
13.0.0-beta.440 7,653 11/15/2025
13.0.0-beta.439 321 11/12/2025
13.0.0-beta.438 243 11/12/2025
13.0.0-beta.436 240 11/12/2025
13.0.0-beta.435 2,813 11/11/2025
13.0.0-beta.433 162 11/10/2025
13.0.0-beta.432 160 11/10/2025
13.0.0-beta.431 176 11/6/2025
13.0.0-beta.430 150 11/6/2025
9.9.0 5,218 11/3/2025
9.9.0-beta.427 156 11/3/2025
9.8.1-beta.426 162 11/3/2025
9.8.1-beta.424 183 10/28/2025
9.8.1-beta.420 140 10/27/2025
9.8.1-beta.419 135 10/27/2025
9.8.1-beta.417 140 10/27/2025
9.8.1-beta.414 151 10/24/2025
9.8.1-beta.413 777 10/22/2025
9.8.1-beta.410 161 10/16/2025
9.8.1-beta.408 134 10/16/2025
9.8.1-beta.407 130 10/16/2025
9.8.1-beta.406 140 10/15/2025
9.8.0 21,563 9/26/2025
9.8.0-beta.405 249 10/15/2025
9.8.0-beta.404 250 10/13/2025
9.8.0-beta.402 270 9/29/2025
9.8.0-beta.401 261 9/29/2025
9.8.0-beta.399 260 9/26/2025
9.8.0-beta.398 265 9/25/2025
9.8.0-beta.397 264 9/25/2025
9.8.0-beta.395 6,060 9/24/2025
9.8.0-beta.394 169 9/23/2025
9.8.0-beta.393 163 9/23/2025
9.8.0-beta.392 174 9/23/2025
9.8.0-beta.389 304 9/18/2025
9.8.0-beta.388 308 9/16/2025
9.8.0-beta.386 537 9/15/2025
9.8.0-beta.385 254 9/15/2025
9.8.0-beta.384 104 9/13/2025
9.8.0-beta.376 341 9/8/2025
9.8.0-beta.375 130 9/6/2025
9.8.0-beta.373 191 9/5/2025
9.8.0-beta.372 206 9/4/2025
9.8.0-beta.370 148 9/2/2025
9.8.0-beta.364 140 9/1/2025
9.7.2 14,210 8/29/2025
9.7.2-beta.362 183 8/29/2025
9.7.2-beta.361 187 8/29/2025
9.7.2-beta.360 181 8/29/2025
9.7.2-beta.359 184 8/28/2025
9.7.2-beta.358 185 8/28/2025
9.7.2-beta.357 191 8/28/2025
9.7.1 766 8/27/2025
9.7.1-beta.355 188 8/27/2025
9.7.1-beta.354 190 8/27/2025
9.7.1-beta.353 183 8/27/2025
9.7.1-beta.352 183 8/27/2025
9.7.1-beta.351 187 8/27/2025
9.7.1-beta.348 193 8/14/2025
9.7.1-beta.344 98 8/10/2025
9.7.1-beta.343 214 8/8/2025
9.7.1-beta.342 228 8/7/2025
9.7.1-beta.341 212 8/6/2025
9.7.1-beta.340 248 8/5/2025
9.7.1-beta.339 204 8/5/2025
9.7.0 4,943 8/1/2025
9.7.0-beta.337 100 8/1/2025
9.7.0-beta.336 115 8/1/2025
9.7.0-beta.335 108 8/1/2025
9.7.0-beta.333 122 7/30/2025
9.6.1-beta.332 114 7/30/2025
9.6.1-beta.331 117 7/30/2025
9.6.1-beta.330 119 7/30/2025
9.6.1-beta.329 122 7/30/2025
9.6.1-beta.328 125 7/29/2025
9.6.1-beta.327 142 7/28/2025
9.6.1-beta.326 138 7/28/2025
9.6.0 11,799 7/10/2025
9.6.0-beta.324 142 7/10/2025
9.5.1-beta.323 138 7/10/2025
9.5.1-beta.322 148 7/10/2025
9.5.1-beta.321 141 7/10/2025
9.5.1-beta.320 166 7/9/2025
9.5.1-beta.319 156 7/8/2025
9.5.1-beta.318 194 7/2/2025
9.5.1-beta.317 146 6/30/2025
9.5.1-beta.315 161 6/26/2025
9.5.1-beta.314 202 6/23/2025
9.5.1-beta.313 224 6/20/2025
9.5.1-beta.312 148 6/20/2025
9.5.1-beta.311 174 6/18/2025
9.5.1-beta.310 171 6/17/2025
9.5.1-beta.309 137 6/17/2025
9.5.1-beta.308 168 6/17/2025
9.5.1-beta.307 172 6/16/2025
9.5.1-beta.306 355 6/11/2025
9.5.1-beta.305 275 6/7/2025
9.5.1-beta.304 191 6/6/2025
9.5.1-beta.303 172 6/4/2025
9.5.1-beta.302 162 6/4/2025
9.5.1-beta.301 180 6/2/2025
9.5.1-beta.300 273 5/28/2025
9.5.0 4,914 5/27/2025
9.5.0-beta.299 166 5/27/2025
9.5.0-beta.298 177 5/26/2025
9.5.0-beta.297 131 5/24/2025
9.5.0-beta.296 116 5/24/2025
9.5.0-beta.295 72 5/24/2025
9.4.1-beta.291 3,155 5/19/2025
9.4.1-beta.289 20,772 5/16/2025
9.4.1-beta.288 244 5/16/2025
9.4.1-beta.287 203 5/16/2025
9.4.1-beta.286 234 5/16/2025
9.4.1-beta.285 254 5/14/2025
9.4.1-beta.284 246 5/13/2025
9.4.1-beta.283 259 5/12/2025
9.4.1-beta.282 476 5/7/2025
9.4.1-beta.280 213 5/2/2025
9.4.1-beta.279 183 5/2/2025
9.4.1-beta.277 769 4/23/2025
9.4.1-beta.276 192 4/23/2025
9.4.1-beta.275 182 4/23/2025
9.4.1-beta.274 167 4/23/2025
9.4.1-beta.273 152 4/23/2025
9.4.1-beta.272 184 4/23/2025
9.4.1-beta.271 177 4/23/2025
9.4.1-beta.270 194 4/20/2025
9.4.0-preview.1.250420-0640 1,439 4/20/2025
9.4.0-beta.269 156 4/20/2025
9.4.0-beta.268 193 4/20/2025
9.3.1-beta.267 493 4/20/2025
9.3.1-beta.266 410 4/19/2025
9.3.1-beta.265 576 4/15/2025
9.3.1-beta.264 510 4/15/2025
9.3.1-beta.263 510 4/15/2025
9.3.1-beta.262 515 4/15/2025
9.3.1-beta.260 1,543 4/10/2025
9.3.1-beta.259 5,782 4/8/2025
9.3.1-beta.258 179 4/8/2025
9.3.1-beta.257 190 4/8/2025
9.3.1-beta.256 186 4/8/2025
9.3.1-beta.255 169 4/8/2025
9.3.1-beta.254 187 4/8/2025
9.3.1-beta.253 216 4/1/2025
9.3.1-beta.252 239 3/27/2025
9.3.1-beta.250 142 3/27/2025
9.3.1-beta.249 161 3/27/2025
9.3.1-beta.248 136 3/27/2025
9.3.1-beta.247 158 3/27/2025
9.3.1-beta.244 504 3/25/2025
9.3.1-beta.242 512 3/24/2025
9.3.1-beta.241 220 3/19/2025
9.3.0-preview.1.250319-0516 1,393 3/19/2025
9.3.0-beta.239 180 3/19/2025
9.2.2-beta.237 188 3/19/2025
9.2.2-beta.236 318 3/14/2025
9.2.2-beta.230 179 3/13/2025
9.2.2-beta.229 181 3/13/2025
9.2.2-beta.228 220 3/11/2025
9.2.2-beta.227 173 3/11/2025
9.2.2-beta.226 170 3/11/2025
9.2.2-beta.225 178 3/11/2025
9.2.2-beta.224 185 3/11/2025
9.2.2-beta.223 175 3/10/2025
9.2.2-beta.222 169 3/10/2025
9.2.2-beta.220 186 3/9/2025
9.2.2-beta.218 167 3/9/2025
9.2.2-beta.217 228 3/7/2025
9.2.2-beta.216 226 3/7/2025
9.2.2-beta.215 241 3/7/2025
9.2.2-beta.214 212 3/5/2025
9.2.2-beta.213 222 3/5/2025
9.2.2-beta.212 224 3/5/2025
9.2.2-beta.211 210 3/4/2025
9.2.2-beta.210 228 3/4/2025
9.2.2-beta.208 130 3/3/2025
9.2.1-preview.1.250303-0329 843 3/3/2025
9.2.1-beta.207 562 3/2/2025
9.2.1-beta.206 121 3/1/2025
9.2.1-beta.205 120 2/27/2025
9.2.1-beta.204 122 2/26/2025
9.2.1-beta.203 89 2/26/2025
9.2.0-preview.1.250226-0510 9,900 2/26/2025
9.2.0-beta.202 89 2/26/2025
9.2.0-beta.201 113 2/26/2025
9.2.0-beta.199 114 2/26/2025
9.2.0-beta.198 81 2/26/2025
9.1.1-beta.197 156 2/25/2025
9.1.1-beta.196 126 2/25/2025
9.1.1-beta.195 113 2/25/2025
9.1.1-beta.194 130 2/25/2025
9.1.1-beta.193 128 2/25/2025
9.1.1-beta.192 98 2/24/2025
9.1.1-beta.191 123 2/24/2025
9.1.1-beta.190 754 2/19/2025
9.1.1-beta.189 125 2/19/2025
9.1.1-beta.188 111 2/19/2025
9.1.1-beta.187 132 2/19/2025
9.1.1-beta.183 148 2/18/2025
9.1.1-beta.182 120 2/18/2025
9.1.1-beta.181 131 2/18/2025
9.1.1-beta.180 124 2/17/2025
9.1.1-beta.178 303 2/17/2025
9.1.1-beta.177 239 2/12/2025
9.1.1-beta.176 166 2/11/2025
9.1.1-beta.175 122 2/11/2025
9.1.1-beta.173 293 2/10/2025
9.1.1-beta.169 173 2/6/2025
9.1.1-beta.168 108 2/5/2025
9.1.1-beta.166 136 2/5/2025
9.1.1-beta.165 95 2/5/2025
9.1.1-beta.164 125 2/3/2025
9.1.1-beta.162 127 2/3/2025
9.1.1-beta.155 227 1/30/2025
9.1.1-beta.154 117 1/30/2025
9.1.1-beta.153 108 1/30/2025
9.1.1-beta.152 104 1/29/2025
9.1.1-beta.150 107 1/29/2025
9.1.1-beta.148 135 1/26/2025
9.1.1-beta.147 112 1/26/2025
9.1.1-beta.146 116 1/23/2025
9.1.1-beta.145 116 1/22/2025
9.1.1-beta.144 88 1/22/2025
9.1.1-beta.142 121 1/22/2025
9.1.1-beta.140 122 1/22/2025
9.1.1-beta.139 124 1/21/2025
9.1.1-beta.138 103 1/20/2025
9.1.1-beta.137 119 1/17/2025
9.1.1-beta.136 112 1/15/2025
9.1.1-beta.135 75 1/15/2025
9.1.1-beta.134 62 1/15/2025
9.1.1-beta.128 100 1/9/2025
9.1.1-beta.127 102 1/9/2025
9.1.1-beta.126 95 1/9/2025
9.1.1-beta.125 109 1/9/2025
9.1.1-beta.124 90 1/9/2025
9.1.0 22,530 12/12/2024
9.1.0-beta.123 124 1/3/2025
9.1.0-beta.122 124 1/3/2025
9.1.0-beta.121 114 1/2/2025
9.1.0-beta.120 126 12/30/2024
9.1.0-beta.119 112 12/30/2024
9.1.0-beta.118 97 12/30/2024
9.1.0-beta.116 112 12/30/2024
9.1.0-beta.114 116 12/30/2024
9.1.0-beta.113 107 12/30/2024
9.1.0-beta.112 111 12/18/2024
9.1.0-beta.110 95 12/16/2024
9.1.0-beta.109 124 12/12/2024
9.0.1-beta.108 126 12/12/2024
9.0.1-beta.107 99 12/11/2024
9.0.1-beta.106 120 12/12/2024
9.0.1-beta.104 111 12/11/2024
9.0.1-beta.102 175 12/6/2024
9.0.1-beta.99 91 12/6/2024
9.0.1-beta.98 104 12/6/2024
9.0.1-beta.95 123 12/5/2024
9.0.1-beta.94 88 12/5/2024
9.0.1-beta.93 120 12/2/2024
9.0.1-beta.92 128 11/30/2024
9.0.1-beta.91 118 11/30/2024
9.0.1-beta.90 119 11/29/2024
9.0.1-beta.89 122 11/29/2024
9.0.1-beta.88 107 11/27/2024
9.0.1-beta.87 126 11/27/2024
9.0.1-beta.86 114 11/27/2024
9.0.1-beta.84 118 11/24/2024
9.0.1-beta.83 146 11/22/2024
9.0.1-beta.82 131 11/21/2024
9.0.1-beta.81 127 11/19/2024
9.0.1-beta.80 107 11/19/2024
9.0.1-beta.79 114 11/19/2024
9.0.1-beta.77 129 11/15/2024
9.0.0 769 11/15/2024
9.0.0-beta.76 115 11/14/2024
9.0.0-beta.75 109 11/14/2024
9.0.0-beta.74 86 11/14/2024
9.0.0-beta.73 125 11/14/2024
9.0.0-beta.72 120 11/14/2024
9.0.0-beta.71 115 11/13/2024
9.0.0-beta.70 110 11/13/2024
9.0.0-beta.69 143 11/13/2024
9.0.0-beta.68 128 11/13/2024
9.0.0-beta.67 113 11/13/2024
9.0.0-beta.66 126 11/13/2024
9.0.0-beta.63 128 11/12/2024
9.0.0-beta.54 128 10/31/2024
9.0.0-beta.53 111 10/29/2024
8.3.0 470 10/29/2024
8.3.0-beta.51 120 10/29/2024
8.3.0-beta.50 124 10/28/2024
8.3.0-beta.49 123 10/28/2024
8.3.0-beta.48 116 10/28/2024
8.3.0-beta.47 118 10/28/2024
8.3.0-beta.46 94 10/27/2024
8.3.0-beta.45 119 10/25/2024
8.3.0-beta.44 108 10/25/2024
8.3.0-beta.43 120 10/25/2024
8.3.0-beta.42 134 10/24/2024
8.2.1 1,473 10/23/2024
8.2.1-beta.40 108 10/23/2024
8.2.1-beta.39 114 10/23/2024
8.2.1-beta.38 117 10/23/2024
8.2.1-beta.37 121 10/23/2024
8.2.1-beta.36 113 10/23/2024
8.2.1-beta.35 136 10/23/2024
8.2.0-beta.34 127 10/23/2024
8.2.0-beta.33 106 10/23/2024
8.2.0-beta.32 124 10/22/2024
1.0.0-beta.60 118 11/11/2024
1.0.0-beta.58 124 11/4/2024
1.0.0-beta.57 114 11/1/2024
1.0.0-beta.56 113 11/1/2024
1.0.0-beta.55 120 11/1/2024