Community.Microsoft.Extensions.AI.CoreML
0.1.0-preview1
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
<PackageReference Include="Community.Microsoft.Extensions.AI.CoreML" Version="0.1.0-preview1" />
<PackageVersion Include="Community.Microsoft.Extensions.AI.CoreML" Version="0.1.0-preview1" />
<PackageReference Include="Community.Microsoft.Extensions.AI.CoreML" />
paket add Community.Microsoft.Extensions.AI.CoreML --version 0.1.0-preview1
#r "nuget: Community.Microsoft.Extensions.AI.CoreML, 0.1.0-preview1"
#:package Community.Microsoft.Extensions.AI.CoreML@0.1.0-preview1
#addin nuget:?package=Community.Microsoft.Extensions.AI.CoreML&version=0.1.0-preview1&prerelease
#tool nuget:?package=Community.Microsoft.Extensions.AI.CoreML&version=0.1.0-preview1&prerelease
Community.Microsoft.Extensions.AI.CoreML
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_availablereturnsfalsewhen 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.
Related Projects
- apfel — Apple Intelligence CLI & OpenAI-compatible HTTP server (Swift)
- apple-on-device-openai — SwiftUI app exposing Foundation Models as OpenAI server
- Microsoft.Extensions.AI — the abstraction this library implements
Contributing
Contributions are welcome! See docs/plan.md for the current implementation roadmap.
- Fork the repo
- Create a feature branch
- Submit a PR against
main
License
MIT — © Community Contributors
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.AI (>= 10.6.0)
- Microsoft.Extensions.AI.Abstractions (>= 10.6.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
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 |