iOS 27 opens the Foundation Models framework to third-party LLM providers via a new public LanguageModel protocol, allowing anyone to integrate server-based or local models (e.g. Claude, Gemini, CoreAI, MLX) using the same API as Apple's on-device system model.
⢠Any LLM ā cloud, local, or open-source ā can now be swapped in without changing app-level code, since all models share the same LanguageModelSession API.
⢠Anthropic (Claude) and Google (Gemini) are shipping first-party Swift packages built on this protocol, giving developers immediate access to frontier models with no custom networking code.
⢠The protocol's Executor lifecycle (automatic teardown, prewarm, streaming deltas) handles resource management and progressive rendering out of the box, removing boilerplate from every integration.
Implements a minimal LanguageModel + LanguageModelExecutor conformance that echoes the user's prompt back, demonstrating how a real third-party provider would slot into the Foundation Models framework.
import FoundationModels
// MARK: - Configuration (Hashable lookup key for Executor reuse)
struct EchoModelConfiguration: LanguageModelConfiguration {
let serverURL: URL
func hash(into hasher: inout Hasher) {
hasher.combine(serverURL)
}
static func == (lhs: EchoModelConfiguration, rhs: EchoModelConfiguration) -> Bool {
lhs.serverURL == rhs.serverURL
}
}
// MARK: - Executor (does the real work)
final class EchoModelExecutor: LanguageModelExecutor {
typealias Configuration = EchoModelConfiguration
private let config: Configuration
required init(configuration: Configuration) {
self.config = configuration
}
func prewarm() async {
// Open connection or pre-load weights here.
// No-op for this echo example.
}
func respond(
to request: LanguageModelRequest,
model: some LanguageModel,
channel: LanguageModelResponseChannel
) async throws {
// 1. Emit metadata so callers can log request IDs immediately.
await channel.send(.metadataUpdate(.init(modelID: "echo-1.0", requestID: UUID().uuidString)))
// 2. Extract the last user prompt from the transcript.
let userText = request.transcript.entries.compactMap { entry -> String? in
if case .prompt(let content) = entry { return content.text }
return nil
}.last ?? "(no prompt)"
// 3. Emit token-count usage upfront.
let tokenCount = userText.split(separator: " ").count
await channel.send(.usageUpdate(.init(promptTokenCount: tokenCount)))
// 4. Stream echoed response word-by-word.
for word in userText.split(separator: " ") {
await channel.send(.textDelta(String(word) + " "))
try await Task.sleep(for: .milliseconds(80))
}
}
}
// MARK: - LanguageModel (trivially constructable)
struct EchoLanguageModel: LanguageModel {
typealias Executor = EchoModelExecutor
var capabilities: LanguageModelCapabilities { .init(textGeneration: true) }
func makeConfiguration() -> EchoModelConfiguration {
EchoModelConfiguration(serverURL: URL(string: "https://echo.example.com")!)
}
}
// MARK: - Usage (identical to using the system model)
async func runEchoDemo() async throws {
let model = EchoLanguageModel()
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Hello, Foundation Models!")
print(response.content) // "Hello, Foundation Models! "
}Foundation Models is a new Apple framework introduced in iOS 27 that gives developers on-device access to the same Apple Intelligence language model powering system features, enabling text generation, structured output, and tool-calling entirely on-device without a network connection.
iOS 27 opens the Foundation Models framework to third-party LLM providers via a new public LanguageModel protocol, enabling anyone to integrate custom, server-based, or open-source models using the same Swift API as Apple's on-device system model.
App Schemas let developers describe their app's content and actions using pre-defined domain schemas (like the Calendar domain) so Siri can understand, search, and act on app data without custom NLP. Entities conforming to IndexedEntity are donated to Spotlight's semantic index, enabling natural-language queries over app content.
In-depth guide
iOS 27 On-Device AI & Apple Intelligence āFoundation Models is releasing as open source but third-party packages (Claude, Gemini) are not yet shipped as of WWDC 2026 beta. The Configuration type must be Hashable because it is used as a lookup key for the Executor store ā mismatched hash semantics will cause unexpected Executor churn. prewarm() is not guaranteed to be called before respond(); always lazy-load weights as a fallback.
Server-based providers require network access; on-device providers (CoreAI, MLX) require sufficient device memory. Apple Intelligence device required only for the System Language Model and Private Cloud Compute options.
Visual Intelligence brings iOS 17's Visual Look Up capabilities to a new developer-facing API surface in iOS 27, letting apps pipe live camera frames or static images through on-device scene understanding to extract subjects, text, barcodes, and rich semantic labels without any cloud round-trip.