Running On-Device LLMs in .NET MAUI with Microsoft.Maui.Essentials.Ai
The fastest, cheapest, most private LLM call is the one that never leaves the device. In part 7 of his Microsoft.Extensions.AI series, Brandon Minnick swaps cloud models for on-device foundation models in a .NET MAUI app using Microsoft.Maui.Essentials.Ai.
What you’ll learn
- What the package does — surfaces on-device models (Apple Intelligence, Google Gemini) through the same
IChatClientused earlier in the series, so streaming, chat history, and function calling all still work - Opting into the experimental API — suppressing
MAUIAI0001in your csproj, plus the iOS 26+/macOS 26+ physical-device requirement - Runtime capability check + fallback — registering an
AddChatClientthat uses Apple Intelligence when available and falls back to Ollama otherwise, with the app only ever seeingIChatClient - Proving it’s offline — deploying to a physical iPhone in Airplane Mode and getting answers from the Neural Engine
- Beyond chat — the on-device
NLEmbeddingGenerator(IEmbeddingGenerator) enabling semantic search on-device too
Read the full post for the MauiProgram.cs wiring and the complete sample project.