Foundation Models - OS 27 and WWDC26
What's New in Foundation Models
Foundation Models is no longer just the Swift wrapper around Apple's on-device language model. In OS 27 it becomes a model surface: images in prompts, Private Cloud Compute, provider packages, built-in tools, Dynamic Profiles, Evaluations, and Mac scripting utilities all share the same shape.
Highlights
SystemLanguageModel, PrivateCloudComputeLanguageModel, Core AI, MLX, and provider packages can back the same session API.
The on-device model can accept image attachments beside text, and Vision-backed tools add OCR and barcode extraction.
Dynamic ProfilesA single session can switch active instructions, tools, models, and reasoning levels without throwing away the transcript.
Evaluate and scriptEvaluations, the fm CLI, Python SDK, and open-source utilities move prompt work out of ad-hoc app builds.
Model Lineup
The biggest architectural change is the new LanguageModel abstraction. A
LanguageModelSession can now be backed by Apple's on-device model, the new
Private Cloud Compute model, Core AI models, MLX models, or a Swift package from a provider.
Fallback for OS 26
Keep OS 26 code on the system model APIs it already uses. Put OS 27-only model selection behind an availability boundary so older builds do not reference new model types or protocol requirements.
import FoundationModels
import MLXFoundationModels
// On-device Apple Foundation Model
let model = SystemLanguageModel()
// Other OS 27 options can use the same session shape:
// let model = PrivateCloudComputeLanguageModel()
// let model = try await CoreAILanguageModel(resourcesAt: modelURL)
// let model = MLXLanguageModel(modelID: "mlx-community/my-model")
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Summarize this note.")
print(response.content)
The practical effect is lower lock-in inside your app architecture. You can keep prompts, tools, transcripts, and guided generation close to the feature, then choose a model based on privacy, latency, capability, and cost.
Image Prompts
The rebuilt on-device model gains vision capabilities. Prompt builders can include image attachments from UIKit/AppKit images, Core Graphics, Core Image, Core Video pixel buffers, or file URLs. Apple says arbitrary sizes and aspect ratios are accepted, but larger images use more tokens and add latency.
Fallback for OS 26
Keep deterministic image work in Vision or Core ML pipelines: classify, run OCR, detect barcodes, then pass the extracted facts as text to your older language-model path.
let session = LanguageModelSession(model: SystemLanguageModel())
let response = try await session.respond {
"What should I notice in this image?"
Attachment(image)
}
Use this for user-facing reasoning over screenshots, receipts, reference photos, and visual context. Keep strict extraction tasks on specialized APIs when you need repeatable fields rather than prose.
Private Cloud Compute
PrivateCloudComputeLanguageModel exposes Apple's server-side model through the same session API.
The WWDC session describes a larger model with a 32,000-token context window and reasoning levels.
It also notes that PCC brings Foundation Models to watchOS 27.
Fallback for OS 26
Route complex tasks to your existing server model path, or keep them on the on-device system model with smaller prompts and no reasoning-level control. Do not silently move user data to a different cloud model without a clear privacy decision.
let model = PrivateCloudComputeLanguageModel()
let session = LanguageModelSession(model: model)
let response = try await session.respond(
to: "Compare these project ideas and pick the best next step.",
contextOptions: ContextOptions(reasoningLevel: .deep)
)
Apple's stated launch policy gives no cloud API cost to qualifying developers with fewer than 2 million first-time App Store downloads, with higher user limits for iCloud+ subscribers. Treat those limits as service policy, not an app contract.
Provider Packages
The model abstraction is also for non-Apple models. Apple says Anthropic and Google are publishing
Swift packages for Claude and Gemini, and provider packages can conform to the same
LanguageModel protocol used by Apple models.
Server-backed providers still bring server-backed responsibilities: authentication, billing, privacy disclosure, logging policy, and secure token handling. Apple explicitly warns against shipping private keys in an app binary.
import FoundationModels
import ProviderFoundationModels
let token = try await authManager.fetchAccessToken()
let model = ProviderLanguageModel(accessToken: token)
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Draft three support replies.")
Usage reporting is part of the updated surface too. Sessions and responses can expose token usage, including cached input tokens and reasoning output tokens, which matters once a third-party provider bills per token.
Built-in System Tools
OS 27 adds system-provided tools that a session can call. BarcodeReaderTool and
OCRTool are backed by Vision, and Apple also describes a Spotlight-powered search tool
for fully local retrieval-augmented generation over indexed content.
Fallback for OS 26
Keep calling Vision and Core Spotlight yourself, then pass the extracted text or search results into the prompt. You lose model-driven tool calls, but retain local processing and predictable control.
let session = LanguageModelSession(
model: SystemLanguageModel(),
tools: [
OCRTool(),
BarcodeReaderTool()
]
)
let answer = try await session.respond {
"Read the important fields from this label."
Attachment(labelImage)
}
Dynamic Profiles
Dynamic Profiles are the new context primitive for agentic app flows. A profile resolves to one active branch at a time, but the session can keep a continuous transcript while the active branch changes its instructions, tools, model, and configuration.
Fallback for OS 26
Continue recreating sessions manually when modes change. Preserve the transcript yourself, and make the mode switch explicit in app state so the old session path remains understandable.
struct CraftProfile: LanguageModelSession.DynamicProfile {
let state: CraftState
var body: some DynamicProfile {
switch state.mode {
case .analysis:
Profile {
Instructions { "Analyze the user's craft image." }
RecordImageAnalysisTool()
SwitchModeTool(state: state)
}
case .brainstorm:
Profile {
Instructions { "Brainstorm project ideas from the analysis." }
RecordBrainstormTool()
}
.model(PrivateCloudComputeLanguageModel())
.reasoningLevel(.deep)
}
}
}
Reach for this when modes are real product states: analyze, search, plan, verify, summarize. If a feature only needs one prompt and one answer, a regular session is still clearer.
Evaluations, fm, and Python
Apple is also filling in the workflow around app code. The new Evaluations framework measures model-driven
feature quality statistically, not as a single deterministic unit test. On Mac, the fm CLI can
run the on-device model or PCC from Terminal, including image prompts and structured output. The Python SDK
exposes the on-device model to notebooks and evaluation pipelines.
Older toolchain fallback
Keep a small checked-in prompt corpus and run it through your existing app or server harness. Store inputs, outputs, judge criteria, and scores so prompt changes are reviewable even before adopting Evaluations or the Python SDK.
let response = try await session.respond(
to: "Recommend a craft that does not require scissors.",
contextOptions: ContextOptions(reasoningLevel: .light)
)
print(response.usage.input.totalTokenCount)
print(response.usage.output.reasoningTokenCount)
Apple says fm ships pre-installed on macOS 27. The Python SDK is installed into a Python
environment and, per Apple's session, needs Python 3.10 or later, Xcode, and an Apple Silicon Mac.
Open Source Utilities
Apple says the core Foundation Models framework is going open source, alongside a Foundation Models framework utilities package that can evolve between OS releases. The utilities package starts with profile modifiers for transcript management, a skill API for procedural knowledge loading, and a language model that can talk to servers using the Chat Completions standard.
That package is the right place to watch for experimental building blocks. Keep app-critical behavior on stable SDK APIs, and treat utilities as a faster-moving layer you can update through Swift Package Manager.
Adoption Checklist
Sources
- Apple Developer: What's new in the Foundation Models framework
- Apple Developer: WWDC26 Apple Intelligence guide
- Apple Developer: WWDC26 iOS guide
- Apple Developer: Bring an LLM provider to the Foundation Models framework
- Apple Developer: Build agentic app experiences with the Foundation Models framework
- Apple Developer: Meet the Evaluations framework
- Apple Developer: Build AI-powered scripts with the fm CLI and Python SDK
- Apple Developer Documentation: Foundation Models