Community.Microsoft.Extensions.AI.CoreML 0.1.0-preview1

This is a prerelease version of Community.Microsoft.Extensions.AI.CoreML.
dotnet add package Community.Microsoft.Extensions.AI.CoreML --version 0.1.0-preview1
                    
NuGet\Install-Package Community.Microsoft.Extensions.AI.CoreML -Version 0.1.0-preview1
                    
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="Community.Microsoft.Extensions.AI.CoreML" Version="0.1.0-preview1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Community.Microsoft.Extensions.AI.CoreML" Version="0.1.0-preview1" />
                    
Directory.Packages.props
<PackageReference Include="Community.Microsoft.Extensions.AI.CoreML" />
                    
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 Community.Microsoft.Extensions.AI.CoreML --version 0.1.0-preview1
                    
#r "nuget: Community.Microsoft.Extensions.AI.CoreML, 0.1.0-preview1"
                    
#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 Community.Microsoft.Extensions.AI.CoreML@0.1.0-preview1
                    
#: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=Community.Microsoft.Extensions.AI.CoreML&version=0.1.0-preview1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Community.Microsoft.Extensions.AI.CoreML&version=0.1.0-preview1&prerelease
                    
Install as a Cake Tool

Community.Microsoft.Extensions.AI.CoreML

License: MIT Platform: macOS 26+ (Apple Silicon)

Use Apple Intelligence on-device models directly from .NET


What is this?

Community.Microsoft.Extensions.AI.CoreML is an open-source IChatClient implementation for the Microsoft.Extensions.AI abstraction that talks directly to Apple's on-device Foundation Models (Apple Intelligence) via P/Invoke — no network calls, no MAUI dependencies.

This lets you use the same IChatClient interface you already know from OpenAI/Azure OpenAI, but backed by the private, local model that runs on any Apple Silicon Mac with macOS 26+.

Why?

Apple Intelligence runs fully on-device, which means:

  • Free — no API costs
  • Private — data never leaves your machine
  • Fast — no network latency
  • Offline — works without internet

The catch: Apple's Foundation Models framework is a Swift/Objective-C API. Existing .NET solutions require installing the full MAUI workload. This library instead ships a thin native C bridge (compiled as a .dylib) that is P/Invoked from C#, making the dependency footprint minimal.

Requirements

Requirement Version
macOS 26 Beta 2 or later
Architecture Apple Silicon (M1 or later)
Apple Intelligence Enabled in System Settings
.NET 8.0 or later
Xcode (to build the native bridge) 26 Beta 2 or later

Runtime Guard Behavior

  • On macOS earlier than 26.0, native bridge calls fail fast with a clear unsupported-platform error.
  • aib_is_available returns false when the OS is below 26.0.
  • On supported systems, availability is checked against an instantiated SystemLanguageModel.

Installation

dotnet add package Community.Microsoft.Extensions.AI.CoreML

⚠️ The NuGet package bundles the pre-built native bridge dylib for macOS arm64. No separate installation is required.

Quick Start

using Community.Microsoft.Extensions.AI.CoreML;
using Microsoft.Extensions.AI;

IChatClient client = new AppleIntelligenceChatClient();

var response = await client.GetResponseAsync([
    new ChatMessage(ChatRole.User, "Summarise the key ideas of stoicism in three bullet points.")
]);

Console.WriteLine(response.Text);

Dependency Injection

builder.Services.AddChatClient(
    new AppleIntelligenceChatClient()
);

How it Works

flowchart TD
    App[".NET Application\nIChatClient"]
    Client["AppleIntelligenceChatClient\nP/Invoke"]
    Dylib["libAppleIntelligenceBridge.dylib\nSwift / C bridge"]
    FM["Apple Foundation Models\nLanguageModelSession"]

    App -->|"Microsoft.Extensions.AI"| Client
    Client -->|"P/Invoke  ·  arm64"| Dylib
    Dylib -->|"Swift API"| FM

The library ships a thin Swift C-bridge (@_cdecl exported functions) compiled into a native dylib. The C# layer P/Invokes these functions and maps them to the IChatClient / IStreamingChatClient contracts.

For more detail see docs/architecture.md.

Contributing

Contributions are welcome! See docs/plan.md for the current implementation roadmap.

  1. Fork the repo
  2. Create a feature branch
  3. Submit a PR against main

License

MIT — © Community Contributors

Product Compatible and additional computed target framework versions.
.NET 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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview1 53 5/28/2026