Microsoft.AI.Foundry.Local 0.3.0

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

Foundry Local C# SDK

Installation

To use the Foundry Local C# SDK, you need to install the NuGet package:

dotnet add package Microsoft.AI.Foundry.Local

Building from source

To build the SDK, run the following command in your terminal:

cd sdk/cs
dotnet build

You can also load FoundryLocal.sln in Visual Studio 2022 or VSCode. Update your nuget.config to include the local path to the generated NuGet package:

<configuration>
  <packageSources>
    <add key="foundry-local" value="C:\path\to\foundry-local\sdk\cs\bin\Debug" />
  </packageSources>
</configuration>

Then, install the package using the following command:

dotnet add package FoundryLocal --source foundry-local

Usage

For this example, you'll need the OpenAI Nuget package installed as well:

dotnet add package OpenAI
using Microsoft.AI.Foundry.Local;
using OpenAI;
using OpenAI.Chat;
using System.ClientModel;
using System.Diagnostics.Metrics;

var alias = "phi-3.5-mini";

var manager = await FoundryLocalManager.StartModelAsync(aliasOrModelId: alias);

var model = await manager.GetModelInfoAsync(aliasOrModelId: alias);
ApiKeyCredential key = new ApiKeyCredential(manager.ApiKey);
OpenAIClient client = new OpenAIClient(key, new OpenAIClientOptions
{
    Endpoint = manager.Endpoint
});

var chatClient = client.GetChatClient(model?.ModelId);

var completionUpdates = chatClient.CompleteChatStreaming("Why is the sky blue'");

Console.Write($"[ASSISTANT]: ");
foreach (var completionUpdate in completionUpdates)
{
    if (completionUpdate.ContentUpdate.Count > 0)
    {
        Console.Write(completionUpdate.ContentUpdate[0].Text);
    }
}
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 was computed.  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.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Microsoft.AI.Foundry.Local:

Package Downloads
Aspire.Hosting.Azure.AIFoundry

Azure AI Foundry resource types for Aspire.

Rystem.PlayFramework.Adapters.FoundryLocal

Foundry Local adapter for Rystem.PlayFramework. Runs AI models locally for development and testing using Microsoft.AI.Foundry.Local SDK. Automatically downloads, loads, and starts a local OpenAI-compatible web service.

Aspire.Hosting.Foundry

Microsoft Foundry resource types for Aspire.

ElBruno.MAF.FoundryLocal.Adapter

Adapter package that bridges Foundry Local SDK with Microsoft.Extensions.AI IChatClient for Agent Framework usage.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Microsoft.AI.Foundry.Local:

Repository Stars
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
rwjdk/MicrosoftAgentFrameworkSamples
Samples demonstrating the Microsoft Agent Framework in C#
Version Downloads Last Updated
1.2.3 2,156 6/12/2026
1.2.2 171 6/12/2026
1.2.1 1,669 6/5/2026
1.2.0 511 5/28/2026
1.1.0 45,775 5/5/2026
1.0.0 1,556 4/9/2026
0.9.0 4,228 3/10/2026
0.8.2.1 11,500 11/20/2025
0.8.0.1 610 11/18/2025
0.3.0 131,337 9/23/2025
0.2.0 520 9/12/2025
0.1.0 15,056 6/20/2025