john-rocky/privatefoundationmodels — explained in plain English
Analysis updated 2026-05-18
Add on-device AI chat features to an iOS app that also needs to support iOS 18.
Swap in a custom open-source model from the mlx-community catalogue instead of Apple's built-in model.
Expose an on-device Apple model as an OpenAI-compatible HTTP API for non-Swift clients.
Write AI features once in Apple's FoundationModels style and stay compatible when dropping older OS support later.
| john-rocky/privatefoundationmodels | aydahnizzy/calendar-drag-interaction | dizzpy/boo | |
|---|---|---|---|
| Stars | 4 | 4 | 4 |
| Language | Swift | Swift | Swift |
| Setup difficulty | moderate | easy | easy |
| Complexity | 3/5 | 2/5 | 2/5 |
| Audience | developer | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Different backends need different minimum OS versions (iOS 17 for MLX, iOS 18 for CoreML, iOS 26 for native Apple passthrough).
PrivateFoundationModels is a Swift library for iOS and macOS developers who want to add on-device AI language model features to their apps, but need those features to work across a wider range of devices and operating system versions than Apple's own framework currently allows. Apple introduced its FoundationModels framework with iOS 26, giving apps access to an on-device AI model that runs privately on the device, with no data sent to a server. The catch is that it only works on iOS 26 and later. PrivateFoundationModels acts as a compatibility layer: you write your code using the same call style as Apple's FoundationModels API, and the library figures out which AI backend to use based on what the device supports. On iOS 26 it passes through to Apple's own framework and on-device model. On iOS 18, it routes to CoreML and the Apple Neural Engine instead. On iOS 17 and above it can also use MLX, a GPU based runtime that can run a wide variety of open models from the mlx-community catalogue. The key benefit is that you write your app code once and it runs correctly on all supported devices without branching logic. When you eventually drop support for older OS versions, switching to Apple's native framework is a simple find and replace of the import name. The library also includes an optional local HTTP server that exposes any of the supported backends using the OpenAI-compatible API format, making it possible for Python or other non-Swift programs to send requests to an on-device Apple model as if they were calling a standard API. It is written in Swift, available as a Swift Package Manager package, and the license is MIT. The full README is longer than what was shown.
A Swift library that lets iOS and macOS apps use Apple's on-device AI model style of code on older OS versions, by falling back to CoreML or MLX runtimes.
Mainly Swift. The stack also includes Swift, CoreML, MLX.
MIT lets you use, copy, modify, and distribute this code for any purpose, including commercial products, with only a copyright notice required.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.