Build with the new Apple Foundation Model on Private Cloud Compute
Use Foundation Models to call Apple's Private Cloud Compute server LLM, choose between on-device and PCC models, and handle availability and quotas.
TL;DR
- Private Cloud Compute exposes a larger server LLM through the Foundation Models framework with the same Swift session, structured output, and tool-calling APIs used for the on-device model.
- PCC is privacy-preserving and OS/iCloud-integrated: no API keys, no developer token costs, but it requires Apple Intelligence support, an internet connection, eligibility, and a daily per-user quota.
- Choose between the on-device System model and PCC based on offline needs, quotas, context size, and reasoning; PCC offers 32K context and light/moderate/deep reasoning levels.
- Apps should check model availability and quota state, provide persistent actionable UI for limit states, and use Xcode's simulation options to test availability and quota behavior.
What Private Cloud Compute adds
Private Cloud Compute lets apps access a new server LLM through Apple's privacy-preserving cloud architecture. It is intended for AI features that exceed what the on-device model can comfortably handle, such as reasoning over large inputs, making many tool calls with large outputs, or using the model from watchOS.
The on-device Foundation Models model is also improved with image input, better instruction following, and better custom tool calling, so PCC is not automatically the right choice for every feature.
- User data sent to PCC is used only for the request and is not stored, according to the session.
- PCC is integrated with the OS and iCloud, so apps do not manage authentication, accounts, API keys, or token billing.
- Each user has a daily limit; iCloud+ can provide higher limits.
- The PCC server model is available for apps with fewer than 2M downloads, and developers must apply on the developer website.
Integrating PCC with Foundation Models
The Foundation Models framework provides a unified Swift API across the on-device and PCC models. If an app already uses LanguageModelSession, switching from the default on-device model to PCC is a one-line model selection change.
Structured output with @Generable and tool calling with Tool work the same way against the PCC model, allowing shared feature code across model backends.
- Use
LanguageModelSession()for the default on-device model. - Use
LanguageModelSession(model: PrivateCloudComputeLanguageModel())for the PCC server model. - Check availability before exposing model-backed UI, because PCC, like the on-device model, requires Apple Intelligence device support.
Switch from on-device to PCC
Select PrivateCloudComputeLanguageModel when creating the session to route requests to the PCC server model.
import FoundationModels
let session = LanguageModelSession(
model: PrivateCloudComputeLanguageModel()
)
let response = try await session.respond(
to: "Summarize this article: \(article)"
)Use structured output and tools with PCC
The same @Generable structured output and Tool integration patterns apply to the PCC model.
import FoundationModels
@Generable
struct ArticleSummary {
let oneLineSummary: String
let keyPoints: [String]
}
struct FindRelatedArticlesTool: Tool { }
let session = LanguageModelSession(
model: PrivateCloudComputeLanguageModel(),
tools: [FindRelatedArticlesTool.self]
)
let response = try await session.respond(
to: "Summarize this article: \(article)",
generating: ArticleSummary.self
)Choosing on-device or PCC
The session frames model choice as a product and engineering tradeoff rather than a default upgrade path. Both models are privacy-oriented, but they differ in availability, limits, context size, and capabilities.
Apple recommends evaluating the quality of a specific feature instead of choosing based on assumptions. The updated on-device model may be sufficient for some tasks, while PCC is better suited to larger-context and reasoning-heavy workflows.
- On-device System model: works offline, has no request limits, and has a 4K context size in the comparison discussed in the session.
- PCC model: requires an internet connection, has a daily per-user quota, provides a 32K context size, and supports reasoning.
- Use the Evaluations framework to compare model quality and reasoning levels for the app's actual prompts and outputs.
- Apps can combine on-device and server models for agentic workflows when appropriate.
Check availability before showing PCC UI
Use the model availability API to gracefully handle devices or states where Apple Intelligence-backed model access is unavailable.
import FoundationModels
struct ArticleSummarizationView: View {
private var model = PrivateCloudComputeLanguageModel()
var body: some View {
if model.isAvailable {
// Show UI for making request
} else {
// Fall back
}
}
}Reasoning levels and context size
PCC supports reasoning, where the model generates an additional reasoning segment before producing the final response. The session describes three reasoning levels: light, moderate, and deep.
Reasoning can improve complex responses but consumes tokens because the reasoning segment is generated text. That token use counts toward the model's context size, so apps should choose reasoning levels deliberately and can observe the transcript to show progress for longer requests.
.lightgathers some extra context..moderatelets the model reason more deeply..deepmay produce a reasoning segment longer than the final response and can take more time.- Use
contextSizeon model instances to programmatically adapt to available context.
Set a reasoning level
Set the reasoning level per respond call using ContextOptions.
let response = try await session.respond(
to: prompt,
contextOptions: ContextOptions(reasoningLevel: .light)
)
// Reasoning levels: .light, .moderate, .deepRead model context size
Use contextSize to adapt prompts, document inputs, and tool outputs to the selected model.
SystemLanguageModel().contextSize
// 4096 on 26.0
// 8192 on 27.0 (newer devices)
PrivateCloudComputeLanguageModel().contextSize
// 32768Handling PCC usage limits
PCC requests count against the user's iCloud account quota. When the limit is reached, requests throw an error, but the recommended experience is to proactively reflect quota state in persistent, actionable UI rather than surfacing a generic error or dismissible alert.
The session demonstrates disabling or annotating the request UI, showing limit status, and offering a button that lets the user manage or increase their limit when a limitIncreaseSuggestion is available.
- Check
model.quotaUsage.isLimitReachedto handle an exceeded daily limit. - Check the
.belowLimitstatus andinfo.isApproachingLimitto warn when the user is nearing the limit. - Prefer persistent inline UI over alerts because the user may need the state and action to remain visible.
- Use Xcode's scheme Debug options, under Simulate Apple Foundation Models Availability, to test quota states such as Quota Usage Limit Reached and Nearing Usage Limit.
Show quota-aware UI
Read quota state from PrivateCloudComputeLanguageModel.quotaUsage and surface actionable limit-management UI.
struct ArticleSummarizationView: View {
private var model = PrivateCloudComputeLanguageModel()
var body: some View {
if case .belowLimit(let info) = model.quotaUsage.status {
if info.isApproachingLimit {
Text("Nearing usage limit.")
.foregroundStyle(Color.orange)
}
}
if model.quotaUsage.isLimitReached {
Text("Usage limit exceeded.")
.foregroundStyle(Color.red)
}
if let suggestion = model.quotaUsage.limitIncreaseSuggestion {
Button("Show options") {
suggestion.show()
}
}
}
}Resources
Create robust evaluations for agentic apps
Use Xcode 27's Evaluations framework to synthesize and validate datasets, compare results, and evaluate agentic tool-calling behavior.
Meet Core AI
Core AI brings Apple's on-device inference stack to apps, with PyTorch conversion, Swift runtime APIs, Xcode tooling, profiling, states, and specialization control.