Skip to content
Docs Try Aspire
Docs Try

Get started with the Ollama integrations

⭐ Community Toolkit Ollama logo

Ollama is an open-source platform for running large language models (LLMs) locally. The Aspire Ollama integration — from the Aspire Community Toolkit — lets you model an Ollama server and its models as first-class resources in your AppHost, then hand the connection information to any consuming app — regardless of language.

Adding Ollama through Aspire — rather than wiring up containers and connection strings by hand — gives you:

  • Zero-config local development. Aspire runs Ollama from the docker.io/ollama/ollama container image and automatically downloads the models you declare.
  • Consistent connection info across languages. Once you reference a model from a consuming app, Aspire injects connection properties as environment variables in a predictable format that works from C#, TypeScript, Python, Go, or any other language.
  • Built-in health checks. The hosting integration automatically registers health checks for both the Ollama server and each model resource, so the dashboard and your orchestrator can tell when a model has finished downloading and is ready.
  • Dashboard observability. The Ollama server and its model sub-resources appear in the Aspire dashboard with logs, status, and download progress alongside your other services.
  • A first-class C# client integration. C# apps can use CommunityToolkit.Aspire.OllamaSharp for dependency injection wired up from the same resource name, plus Microsoft.Extensions.AI abstractions for portable AI code.
  • GPU and data-volume support. Enable GPU acceleration with a single method call, and persist downloaded models across container restarts with a named data volume.

The Ollama integration has two sides: a hosting integration that you use in your AppHost to model the Ollama server and model resources, and a connection story for consuming apps that reference them.

architecture-beta

  group apphost(server)[AppHost]
  group consumer(server)[Consuming app]

  service hosting(server)[Hosting integration] in apphost
  service ollama(server)[Ollama server] in apphost
  service model(database)[Model resource] in apphost

  service app(server)[App] in consumer

  hosting:R --> L:ollama
  ollama:R --> L:model
  model:R --> L:app

The hosting integration lives in your AppHost project and models the Ollama server and its models as resources. Consuming apps receive connection information through Aspire’s standard environment-variable injection.

Getting there is a two-step process: model the Ollama resources in your AppHost, then connect to them from each app that needs them.

  1. Add the Ollama hosting integration to your AppHost, then declare an Ollama server, one or more models, and reference them from the apps that need to use them. The Ollama hosting integration article walks through every capability — adding models, HuggingFace models, data volumes, GPU enablement, Open WebUI, and more.

    Set up Ollama in the AppHost

  2. When you reference an Ollama model resource from a consuming app, Aspire injects its connection information as environment variables. See Connect to Ollama for the connection properties reference and per-language examples for C#, Go, Python, and TypeScript — including the full C# client integration.

    Connect to Ollama