Add local AI to your WinUI app

Add on-device text summarization to a WinUI note editor. Keep the original note editable and show an AI-generated draft below it while Foundry Local runs the selected model inside your app.

Local AI with Foundry Local

In this tutorial, you learn how to:

  • Add the Foundry Local SDK to an existing Windows app.
  • Ask before downloading a model and show setup progress.
  • Keep the interface responsive while streaming a summary with a 256-token limit.
  • Cancel generation without replacing the user's original text.
  • Check output quality, recoverable failures, and offline inference.
See full tutorial See code on GitHub
LocalNotes keeps the original note editable and displays a locally generated draft summary below it.
Why Foundry Local

Run a model inside your Windows app

Foundry Local handles model acquisition, compatible hardware acceleration, and inference while your app owns the user experience.
No cloud setup Build the sample without an Azure subscription, API key, separate local server, or per-token service dependency. Get started with Foundry Local Local data path The sample keeps notes and summaries on the device and doesn't fall back to a cloud model. Initial setup still downloads required components. Review privacy details Choose a compatible model Start with a small CPU model, then compare model size, license, quality, and hardware support before choosing one for production. Browse the model catalog
What you'll need

Prepare your local AI development environment

Microsoft Learn contains the current operating system, SDK, workload, model, storage, and download requirements.
A supported Windows 11 PC Use an x64 or Arm64 device with enough memory and disk space for the model. A Copilot+ PC or dedicated NPU isn't required. Review prerequisites WinUI development tools Use Visual Studio 2026 with the WinUI workload, or your preferred editor with the Windows App Development CLI. Download Visual Studio A Foundry Local model Allow internet access for the initial package, model, and runtime downloads, then test the selected model against your app's content. Browse available models

Ready to add local summarization?

Follow the maintained Microsoft Learn tutorial to create LocalNotes, prepare the model, handle cancellation and errors, and verify the feature offline.

See full tutorial