Implemented for the iOS and macOS main apps. New installations default to PCC, existing installations receive a one-time migration that adds and selects the Apple profile, and existing OpenAI-compatible profiles remain available. PCC requests check OS support, model availability, and daily quota before sending; repair loops are capped at three requests. The managed entitlement is limited to the main app targets because widget and share extensions never call an AI backend.
The on-device model fallback described below remains future work. On devices without PCC, users can select an existing OpenAI-compatible profile instead.
Adopt Apple Foundation Models as a new, Apple-first AI backend, with Private Cloud Compute (PCC) as the preferred model when it is available. Do not remove the existing OpenAI-compatible backend yet.
PCC can remove API-key setup for eligible users, but it is not a universal replacement today. It requires iOS, iPadOS, or macOS 27 or later, an Apple- managed entitlement, Apple Intelligence availability, network access, and remaining daily quota. ScriptWidget must keep a functional fallback for older devices, unsupported regions, and exhausted quotas.
Apple exposes PrivateCloudComputeLanguageModel through the Foundation Models
framework. It conforms to the same LanguageModel protocol as the on-device
SystemLanguageModel, so both can be passed to LanguageModelSession.
The PCC model provides a 32K context window and multiple reasoning levels. The on-device model works offline and without a daily quota, but has a 4K context window and no reasoning mode. PCC requests do not require an API key from the person using the app.
Access is conditional:
- The developer must be in the App Store Small Business Program.
- The developer's apps must have fewer than two million first-time downloads.
- Apple must assign the
com.apple.developer.private-cloud-computemanaged entitlement to the developer account. - PCC is available to third-party apps on iOS, iPadOS, macOS, watchOS, and visionOS 27 or later where Apple Intelligence is available.
- PCC has a per-person daily quota. Apple provides quota status and a system path for iCloud+ subscribers to receive more access.
- If eligibility is later lost, Apple allows six months to migrate to another solution.
Primary references:
- Accessing Private Cloud Compute
- Adding server-side intelligence with Private Cloud Compute
- SystemLanguageModel
- Private Cloud Compute security guide
The existing AgentLoop already separates prompt construction, model calls,
runtime execution, and repair iterations. The main coupling is that AIClient
directly constructs a SwiftOpenAI request and AIProfile.isConfigured assumes
every usable provider has a credential.
The current prompt reference can grow to 60,000 characters before it falls back to a curated subset. That is a reasonable fit for PCC's 32K context after token-budget validation, but it cannot fit reliably in the on-device model's 4K context. A compact reference profile is required before the on-device model can be a dependable fallback.
The current maximum of 20 repair iterations also needs a provider-specific budget. Repeated PCC calls can consume a person's daily quota even when the widget never converges.
Introduce an internal client protocol that accepts [AIMessage] and returns
AIChatResult. Keep the existing OpenAI implementation and add an Apple
Foundation Models implementation.
The Apple implementation should create a LanguageModelSession with:
if #available(iOS 27.0, macOS 27.0, *) {
LanguageModelSession(model: PrivateCloudComputeLanguageModel())
} else {
LanguageModelSession(model: SystemLanguageModel.default)
}The production implementation must also check model availability, PCC quota, and the managed entitlement. OS availability alone is not sufficient.
Add a backend kind such as appleIntelligence or openAICompatible to
AIProfile. Apple profiles are configured by capability and availability, not
by the presence of an API key. Preserve decoding of existing profiles as
openAICompatible so this remains an additive migration.
No Apple session data, prompts, or generated responses should be written to profiles, UserDefaults, logs, Skills, or Gallery packages.
Use this order for the default Apple profile:
- PCC when the managed entitlement, OS, model availability, network, and quota allow it.
- The on-device system model when it is available and the compact prompt fits.
- A configured OpenAI-compatible profile, if the user has opted into one.
- A clear capability message explaining why AI generation is unavailable.
Do not silently send a prompt to a third-party provider after PCC fails. A person must explicitly configure and select that fallback because its privacy contract differs from Apple's.
- Add a compact API reference designed for the 4K on-device context.
- Measure the assembled prompt before starting a session.
- Start PCC and on-device generation at three repair iterations rather than inheriting the current maximum of 20.
- Surface quota and availability as product state, not as a generic network error.
- Treat token counts as optional because Foundation Models does not expose the same usage object as the OpenAI-compatible API.
Run Foundation Models only from the iOS or macOS Studio/app process. Generated JSX continues through the existing sandboxed validation path before it is saved. Widget extensions must not perform model inference or gain the PCC entitlement.
- Confirm Small Business Program enrollment and the two-million-download eligibility threshold.
- Request the PCC managed entitlement from Apple.
- Add a representative evaluation set for fresh generation, repair, refine, and Copilot flows.
- Compare PCC output quality and convergence against the current baseline.
Do not ship a PCC control before Apple assigns the entitlement. Adding an unapproved entitlement would break signing rather than create a usable model.
- Land the provider-neutral client boundary.
- Add the compact 4K prompt and
SystemLanguageModelimplementation. - Offer Apple Intelligence as a zero-key option on supported OS 26 devices.
- Retain the OpenAI-compatible provider unchanged.
This phase validates the application architecture without depending on cloud entitlement approval, although its smaller model may not meet the quality bar for complex widget generation.
- Compile the PCC adapter with the iOS/macOS 27 SDK while retaining availability guards and older-OS fallback.
- Add the entitlement only to the iOS and macOS app targets after approval.
- Display quota status before generation and map quota errors to actionable UI.
- Make Apple Intelligence the first-run default only after evaluation results meet the existing agent-loop baseline.
- Remove API-key instructions from first-run UI for supported Apple devices.
- Move third-party providers under an optional advanced/fallback section.
- Keep existing Keychain-backed profiles and their migration path.
- Unit tests for existing profile migration and Apple profiles without secrets.
- Deterministic client tests for PCC available, unavailable, quota-warning, quota-exhausted, offline, and cancellation states.
- Prompt-size tests for both 4K and 32K model budgets.
- Agent-loop evaluation comparisons for generation success and repair count.
- iOS and macOS app builds on both the oldest supported SDK and the iOS/macOS 27 SDK.
- Signed TestFlight or ad hoc testing after entitlement approval. Simulator-only testing is not sufficient evidence that PCC access works.
Proceed with the provider abstraction and on-device evaluation now, and apply for the PCC entitlement in parallel. Make PCC the default only after entitlement approval and quality/quota evaluation. This reaches the zero-key onboarding goal without making AI generation disappear for users whom PCC cannot serve.