WWDC Quick Look đź’“ By SwiftGGTeam
Build with the new Apple Foundation Model on Private Cloud Compute

Build with the new Apple Foundation Model on Private Cloud Compute

Watch original video

Highlight

Apple opens the server-side large model running on Private Cloud Compute (PCC) to third-party apps. Developers can switch an on-device LLM call to a 32K-context cloud model by changing one line of code - passing PrivateCloudComputeLanguageModel() - with no API key, no authentication setup, and no token fees, while still handling each user’s daily quota limit.

Core Content

The ceiling of on-device models

Last year, Apple introduced the Foundation Models framework, letting developers call an on-device LLM in three lines of code. But a 4K context window and limited compute make even moderately complex scenarios feel cramped. If you want to build an assistant that analyzes long documents, or a feature that calls tools several times and generates a large output, the on-device model simply cannot fit the task. (00:16)

Developers who wanted to break past that limit usually had to integrate a third-party cloud API. That meant managing API keys, handling authentication, paying token costs, and explaining data-privacy implications to users. For independent developers and small teams, that is real cost and cognitive overhead.

One line of code brings cloud compute

Apple’s answer this year is to open the Private Cloud Compute (PCC) used by its own system features to third-party apps. The server model on PCC provides a 32K context window, supports more complex reasoning, and uses the same calling model as the on-device model. (00:39)

The clearest benefit is migration at almost zero code cost. If you already use the Foundation Models framework, you only need to change the initialization argument for LanguageModelSession:

let session = LanguageModelSession(
    model: PrivateCloudComputeLanguageModel()
)

Structured output (@Generable) and tool-calling (Tool) code do not need to change. The same respond(to:) method and the same generating: parameter work consistently across on-device and cloud models. (03:02)

No API key, but quotas still matter

PCC is deeply integrated with iCloud. Users do not need to register a new account, and developers do not need to configure an API key. As long as the user’s device supports Apple Intelligence, the app can use it directly. (02:02)

There is no such thing as a free lunch. PCC calls are tied to the user’s iCloud account, and every user has a daily quota. Users can get a higher limit by upgrading iCloud+, but developers must handle quota exhaustion gracefully inside the app. If a user has used up the day’s quota, the request throws an error directly. Showing an Alert that says “Something went wrong” is a poor experience. (07:14)

Apple’s recommendation is to detect quota status in the UI in real time, provide a gentle warning near the limit, disable the request button when the quota is exhausted, and guide the user toward an upgrade. All status information is exposed through the quotaUsage property on PrivateCloudComputeLanguageModel, and it takes only a few lines of code. (08:07)

Details

On-device vs cloud: how to choose a model

(04:06)

The two models fit different scenarios:

DimensionOn-device modelPCC cloud model
Network dependencyWorks offlineRequires a network connection
Request limitsUnlimitedDaily quota
Context size4K on older devices / 8K on newer devices32K
Reasoning capabilityNot supportedLight / Moderate / Deep levels
PrivacyData stays on deviceEnd-to-end encrypted, not stored

In code, use the contextSize property to dynamically retrieve the current model’s context size:

SystemLanguageModel().contextSize        // 4096 (older devices) or 8192 (newer devices)
PrivateCloudComputeLanguageModel().contextSize  // 32768

(05:58)

Check availability

PCC is only available on devices that support Apple Intelligence. In the UI, check isAvailable before deciding whether to show related features:

import FoundationModels

struct ArticleSummarizationView: View {
    private var model = PrivateCloudComputeLanguageModel()

    var body: some View {
        if model.isAvailable {
            // Show the PCC feature UI
        } else {
            // Fall back to the on-device model or another approach
        }
    }
}

(03:51)

Key points:

  • isAvailable can be used directly in a View’s body, and SwiftUI responds automatically to state changes
  • Devices that do not support Apple Intelligence, such as those without an A17 Pro or M-series chip, return false
  • Never assume availability; always provide a fallback

Structured output and tool calling are fully reusable

The on-device model’s @Generable and Tool protocols behave the same on the PCC model:

import FoundationModels

@Generable
struct ArticleSummary {
    let oneLineSummary: String
    let keyPoints: [String]
}

struct FindRelatedArticlesTool: Tool {
    // Tool implementation...
}

let session = LanguageModelSession(
    model: PrivateCloudComputeLanguageModel(),
    tools: [FindRelatedArticlesTool.self]
)

let response = try await session.respond(
    to: "Summarize this article: \(article)",
    generating: ArticleSummary.self
)

(03:25)

Key points:

  • Struct definitions marked with @Generable do not change
  • Tool implementations conforming to the Tool protocol do not change
  • The call shape for respond(to:generating:) does not change
  • Switching models only requires changing the LanguageModelSession initialization argument

Set reasoning level

The PCC model supports three reasoning levels, allowing the model to “think” before generating the final answer:

let response = try await session.respond(
    to: prompt,
    contextOptions: ContextOptions(reasoningLevel: .light)
)
// .light: the model gathers a small amount of extra context
// .moderate: medium-depth reasoning
// .deep: reasoning text may be longer than the final answer

(05:26)

Key points:

  • Reasoning produces additional text fragments stored in the session transcript
  • You can observe the transcript to show reasoning progress, especially in .deep mode
  • Reasoning text consumes tokens and counts against the 32K context limit
  • Do not use .deep for simple tasks, or you will waste quota

Handle quota limits gracefully

When quota is exhausted, do not show an Alert. Update UI state instead:

struct ArticleSummarizationView: View {
    private var model = PrivateCloudComputeLanguageModel()

    var body: some View {
        VStack {
            Button("Generate Summary") {
                // Start the request
            }
            .disabled(model.quotaUsage.isLimitReached)

            if case .belowLimit(let info) = model.quotaUsage.status,
               info.isApproachingLimit {
                Text("Quota is almost used up")
                    .foregroundStyle(Color.orange)
            }

            if model.quotaUsage.isLimitReached {
                Text("Today's quota is used up")
                    .foregroundStyle(Color.red)
                if let suggestion = model.quotaUsage.limitIncreaseSuggestion {
                    Button("Get More Quota") {
                        suggestion.show()
                    }
                }
            }
        }
    }
}

(09:41)

Key points:

  • quotaUsage.status returns .belowLimit(info) or a quota-exhausted state
  • info.isApproachingLimit means the user is near the limit, which is a good time for a gentle hint
  • Disable the request button when isLimitReached is true
  • limitIncreaseSuggestion provides a button that guides the user toward an upgrade; call show() to present the system UI
  • Avoid Alert and use persistent inline UI instead

Debug quota status in Xcode

Xcode provides debug options for simulating quota status. In Scheme > Debug > Options, choose “Simulate Apple Foundation Models Availability” to simulate quota exhaustion (Quota Usage Limit Reached) or approaching the limit (Nearing Usage Limit), without waiting for a real user to hit the cap. (09:12)

Key Ideas

1. Build an “intelligent document assistant”

An on-device model with a 4K context can only handle a few pages. PCC’s 32K context can take in an entire book. Define structured output with @Generable, and let the model extract key information, generate summaries, and answer specific questions from long documents.

  • What to build: An intelligent reading assistant for PDF, Word, and Markdown
  • Why it is worth building: PCC’s 32K context lets on-device apps handle truly long documents for the first time, while data stays inside Apple’s privacy architecture
  • How to start: Create a session with PrivateCloudComputeLanguageModel(), define an @Generable struct that describes the output format, and call respond(to:generating:) for structured results

2. Progressive AI features with multiple reasoning levels

Not every task needs .deep reasoning. Use the on-device model for simple questions, PCC .light for complex questions, .moderate for deeper analysis, and .deep for research-grade tasks.

  • What to build: An intelligent routing layer that chooses the model and reasoning level based on task complexity
  • Why it is worth building: Save user quota, improve response speed, and keep working offline with the on-device model
  • How to start: Try the on-device model first; if confidence is low or context is insufficient, switch to PCC. Use the contextSize property to decide dynamically

3. A personal knowledge base with tool calling

PCC supports the Tool protocol, so the model can call your custom tools. Combined with a 32K context, this enables a personal assistant that can search local notes, query calendars, and retrieve contacts.

  • What to build: A personal AI assistant that calls multiple data sources inside the app
  • Why it is worth building: A hybrid on-device plus PCC architecture balances privacy and performance
  • How to start: Implement the Tool protocol for tools such as search and lookup, then pass them through the tools argument when initializing LanguageModelSession

4. Quota-aware progressive fallback

When a user’s quota is exhausted, do not just show an error. Automatically fall back to the on-device model for simple tasks, while prompting the user to upgrade iCloud+ in the UI.

  • What to build: An intelligent fallback system that switches models after quota exhaustion
  • Why it is worth building: Core features remain available instead of breaking because of quota limits
  • How to start: Observe quotaUsage.isLimitReached. When true, create LanguageModelSession() without passing a model argument, using the default on-device model for simple requests

5. AI features on watchOS

PCC can be called from watchOS. Apple Watch has extremely limited compute, but PCC gives the watch access to cloud-scale model capabilities.

  • What to build: Voice summaries, health-data analysis, and other AI features on Apple Watch
  • Why it is worth building: watchOS gets server-class LLM capability for the first time, without requiring the watch to connect independently to the network because it can use the paired iPhone
  • How to start: In a watchOS app, import FoundationModels directly and use the same API as on iOS

Comments

GitHub Issues · utterances