Apple Intelligence for developers: the Foundation Models framework
With iOS 26 and macOS 26, Apple did something quietly radical: it opened the model behind Apple Intelligence to every third-party app. The Foundation Models framework gives you direct Swift access to the ~3-billion-parameter model that ships inside the operating system — no download, no API key, no per-token bill.
The API in three lines
The entry point is LanguageModelSession:
SystemLanguageModel.default.availability— check the device supports it and Apple Intelligence is enabledLanguageModelSession(instructions:)— open a session, optionally with a system promptsession.streamResponse(to:)— stream a reply as an async sequence
Multi-turn context lives inside the session. Everything runs on the Neural Engine; nothing leaves the device.
What we learned shipping privateSLM with it
We use Foundation Models as the default engine in privateSLM, with a llama.cpp fallback for devices without Apple Intelligence. Some field notes:
- The stream yields snapshots, not deltas. Each iteration of
streamResponsegives you the cumulative text so far. If your UI appends chunks, diff against the previous snapshot and emit only the suffix — and readpartial.content, not the snapshot object itself. Our first build stringified the whole struct and users would have seenSnapshot(content: …)in every reply. Live testing caught it before review did. - Availability is a spectrum, not a boolean. The model can be unsupported (old hardware), disabled (Apple Intelligence off), or still downloading. Treat anything but
.availableas "use your fallback." - Guard with
#availableandcanImport. Older toolchains can't even import the framework — wrap the bridge so the same codebase builds everywhere and degrades cleanly. - Design for both engines from day one. A thin engine interface (system model | local GGUF) kept our UI identical across devices and made the fallback path testable.
What it means for users
Apps no longer have to choose between "smart" and "private." The smartest assistant experience on a modern iPhone can be one where the words never leave the phone — and the OS itself provides the brain. That's the bet we've made with privateSLM.