Since the OS 27 releases, Apple's Foundation Models framework can run third-party models such as Claude and Gemini through the new LanguageModel protocol, and Apple's own Private Cloud Compute model is free for Small Business Program developers under 2 million first-time downloads. Put model choice in one function, add Claude with App Attest instead of a bundled API key, share one @Generable type across routes, show a clear message for each failure, and get consent before personal data goes to a third-party AI.
Apple's Foundation Models framework page climbed to the Hacker News front page on 13 November 2026, more than 200 points and a long comment thread, and most of the discussion was about two lines on that page. One says the framework "now extends to server models — like Claude, Gemini, and more — all through the same Swift API." The other says developers in the App Store Small Business Program with fewer than two million first-time downloads can use Apple's own models on Private Cloud Compute "with no cloud API cost."
Both features arrived with the OS 27 releases, announced at WWDC in June. They are back in the news because many iOS developers are only now noticing them, and because the first third-party packages, including Anthropic's ClaudeForFoundationModels, are out where people can try them. If you build iOS apps, and especially if you built one with an AI coding tool and called a model API straight from the app, this changes how you should wire AI features. You can now write one session layer, choose the model at run time, and stop shipping an API key inside your binary.
This guide covers what Apple and Anthropic have actually published, what it means for your code, and the steps to move an existing AI feature onto it without breaking App Review rules. The Swift snippets follow the official docs and the package README. The parts that exist in the iOS 26 SDK were later compiled and run on a Mac, as described after Step 6. The OS 27 parts could not be, because the Mac used has Xcode 26.2, so treat those as a starting point and let Xcode correct the details.
What changed in the Foundation Models framework
Until OS 27, Foundation Models meant one thing: Apple's on-device model, reached through SystemLanguageModel. Apple's June 2026 update notes add two changes that matter here. You can adopt the new LanguageModel protocol "to use any large language model — server or on-device — with the Foundation Models framework," and you can use PrivateCloudComputeLanguageModel "to access more reasoning capabilities and a larger context size."
LanguageModel is a protocol available from iOS 27, iPadOS 27, macOS 27, tvOS 27, visionOS 27 and watchOS 27. Apple's documentation describes it as the bridge between a model and the framework. A provider writes a Swift package that conforms to it, and you hand an instance of that model to the same LanguageModelSession you already use for the on-device model. The docs list SystemLanguageModel and PrivateCloudComputeLanguageModel as conforming types.
The Foundation Models page lists these supported third-party models:
| Model option | Where it runs | How you add it | Who pays for inference |
|---|---|---|---|
| SystemLanguageModel | On the device | Built into the OS | Nobody; it runs locally |
| PrivateCloudComputeLanguageModel | Apple's Private Cloud Compute | Built in, needs a managed entitlement | No cloud API cost for eligible small developers, within daily limits |
| Claude | Anthropic's servers | Swift package from github.com/anthropics/ClaudeForFoundationModels | You, through your Anthropic account |
| Gemini | Google's servers | Through the Firebase iOS SDK | You, through Firebase or Google |
| Core AI and MLX language models | On the device | Open source packages from Apple and the MLX project | Nobody; local, but you ship or download the weights |
One Hacker News commenter pointed out that OpenAI is missing from that list. Apple's wording says "and more," and any provider can write a conforming package, so treat the list as what exists today.
Why this matters if your app calls a model API directly
Many apps built quickly with Cursor, Claude Code, Bolt or Rork call a model provider straight from the app with a key stored in the code or in a plist. That key can be pulled out of the shipped binary. Anyone who finds it can run up your bill. The usual fix has been a small backend that holds the key and relays requests, which is one more service to build, pay for and secure. Backdoored Claude Code Extension in Cursor: Check Your Mac, Then Rotate These iOS Keys covers rotating a key that has leaked.
The new setup gives you two ways out. Apple's Private Cloud Compute model needs no key at all, because the request goes through Apple's system under your app's entitlement. Claude's package supports App Attest, where the app proves to Anthropic that it is your genuine app on a real Apple device, so no secret ever sits in the binary. The README describes this mode as "no key in the app, no developer backend."
There is also a design benefit. Because every model sits behind the same LanguageModelSession API, your prompts, your @Generable types and your tools can stay the same while the model underneath changes. You can start on the free on-device model, move hard requests to Private Cloud Compute, and send the rest to Claude, all from one code path.
Step 1: Check your deployment target
Start with the floor. The LanguageModel protocol and PrivateCloudComputeLanguageModel are iOS 27 and later. SystemLanguageModel and its availability check go back to iOS 26. The ClaudeForFoundationModels README lists iOS 27, macOS 27, visionOS 27 or watchOS 27 and Xcode 27, and it still labels the package as beta, warning that "APIs may change before general availability."
If your app supports iOS 26 or older, you need an availability check around anything that uses server models, plus a fallback for older systems. That fallback can be your existing networking code or a message that the feature needs a newer iOS version. Open your target's General tab in Xcode, look at Minimum Deployments, and write down which iOS versions you support before you change anything.
if #available(iOS 27, *) {
// Server models and Private Cloud Compute are possible here.
} else {
// Keep the old path, or hide the feature.
}
Step 2: Put model choice in one place
The worst version of this migration scatters LanguageModelSession(model: ...) calls across twenty view models. Make one small type that decides which model to use and builds the session. Everything else asks it for a session.
import FoundationModels
import ClaudeForFoundationModels
@available(iOS 27, *)
enum ModelRoute {
case onDevice
case privateCloud
case claude(clientID: String)
}
@available(iOS 27, *)
func makeSession(for route: ModelRoute) -> LanguageModelSession {
switch route {
case .onDevice:
return LanguageModelSession(model: SystemLanguageModel.default)
case .privateCloud:
return LanguageModelSession(model: PrivateCloudComputeLanguageModel())
case .claude(let clientID):
let claude = ClaudeLanguageModel(
name: .sonnet5,
auth: .appAttest(clientID: clientID)
)
return LanguageModelSession(model: claude)
}
}
Then decide the route from what the device can do. Apple's docs give SystemLanguageModel.default.availability, which is either .available or .unavailable with a reason, and PrivateCloudComputeLanguageModel has an isAvailable Boolean. Apple notes that availability "depends on whether the device and region supports Apple Intelligence."
@available(iOS 27, *)
func chooseRoute(needsBigModel: Bool, claudeClientID: String) -> ModelRoute {
let cloud = PrivateCloudComputeLanguageModel()
if needsBigModel {
return cloud.isAvailable ? .privateCloud : .claude(clientID: claudeClientID)
}
if case .available = SystemLanguageModel.default.availability {
return .onDevice
}
return cloud.isAvailable ? .privateCloud : .claude(clientID: claudeClientID)
}
The rule in that function is only an example. Pick yours from what each feature needs. A short summary or a tag suggestion can usually stay on the device. A long document or a multi-step plan may need the larger context of a server model. Keep the rule in one file so you can change it after you see real usage.
Step 3: Find out whether Private Cloud Compute is free for you
Apple's Private Cloud Compute page lists three conditions for using its models with no cloud API cost. You must be enrolled in the App Store Small Business Program. Your apps must have fewer than 2 million first-time downloads on the App Store in total. And the Private Cloud Compute entitlement must be assigned to your account, which you request through a form linked from that page.
The Small Business Program has its own rule: you and any associated developer accounts must have earned no more than 1 million USD in proceeds in the previous calendar year, and no more than that in the current year. Enrolling also needs the Account Holder to accept the latest Paid Apps agreement in App Store Connect.
Read the exit clause before you build your product around this. Apple says that if any app passes 2 million first-time downloads, or you leave the Small Business Program, you will be notified and "must migrate to an alternative solution within 6 months." That is the best argument for Step 2. If model choice lives in one function, moving from Private Cloud Compute to Claude or Gemini later means changing a route, not rewriting features.
Testing does not count against the threshold. Apple says eligible developers can test with TestFlight or ad hoc builds and that "installs during testing are not counted as first-time app downloads."
There is a usage limit too. Apple's footnote says server features, including "Developer apps using Apple Foundation Models in Private Cloud Compute," have daily limits that "may vary by feature, request complexity, system demand, system policies, and other factors," and that expanded access "will be available for a fee in the future." Apple publishes no number. In the Hacker News thread, developers using it said the allowance is tied to the user's Apple account, not to the developer account. That matches the earlier news that Apple sells paid Apple Intelligence usage packs to users. In practice, a heavy user of your app can hit a limit you cannot see in advance, so you need a plan for that moment. Apple Now Sells $49.99 AI Usage Packs covers how to design around those limits.
Step 4: Add Claude with App Attest instead of an API key
Add the package in Xcode with File > Add Package Dependencies, using https://github.com/anthropics/ClaudeForFoundationModels.git. The README's Package.swift line pins it from version 0.1.0. Add ClaudeForFoundationModels to your app target and import it next to FoundationModels.
The package offers three authentication modes, and the README is clear about which one belongs in a shipping app:
.appAttest(clientID:)is the recommended mode. It works in development and production but needs a physical device..apiKey(...)is for simulator work. The README warns that "a bundled key is extractable from a shipping app, so don't release with one.".proxied(headers:)with abaseURLsends requests to your own backend, which adds the credential on the server.
App Attest needs some setup. Register your team ID and bundle ID in the Anthropic console to get a client ID. The README says that client ID "is public and safe to include in the binary." Add the App Attest entitlement, com.apple.developer.devicecheck.appattest-environment, which needs an explicitly registered App ID rather than a wildcard one. Then test on a real device: simulators and hardware without a Secure Enclave throw ClaudeError.attestationUnsupported.
The first request on a fresh install attests the device, which the README says takes a few seconds once per install. You can move that wait to app launch:
let claude = ClaudeLanguageModel(
name: .sonnet5,
auth: .appAttest(clientID: "clid_your_client_id")
)
Task {
do {
try await claude.authenticateIfNeeded()
} catch {
// Log it. Fall back to another route for this session.
}
}
The README prefers authenticateIfNeeded() over session.prewarm() because prewarm starts attestation without reporting errors. After the first run, the package caches a short-lived token in the Keychain. The README adds that credentials are bound to the device and never sync or back up, so a user restoring to a new phone will attest again.
For simulator work, keep the API key out of source control. Read it from an environment variable in your scheme, as the README does with ProcessInfo.processInfo.environment["ANTHROPIC_API_KEY"], and wrap that code in #if targetEnvironment(simulator) so it can never reach a release build.
Step 5: Share one output type across every model
Guided generation is where the shared API pays off most. Define the output once with @Generable and @Guide, and ask any session for that type. The README says all of Claude's compiled-in models support structured output through this path.
@Generable
struct ReviewNoteDraft {
@Guide(description: "One-line summary of what the build changes")
var summary: String
@Guide(description: "Steps a reviewer follows to reach the new feature")
var steps: [String]
}
let session = makeSession(for: route)
let result = try await session.respond(
to: "Write App Review notes for this changelog: \(changelog)",
generating: ReviewNoteDraft.self
)
print(result.content.summary)
Test the same prompt on every route you plan to use. Apple's update notes warn that the on-device model changes when people update their OS and tell you to test prompts with each new model. The same applies when you move a prompt from Apple's model to Claude. Your types will decode either way, but the quality of what lands in each field can differ a lot.
Step 6: Handle limits, refusals and missing credentials
Every route can fail in its own way, and your interface needs a message for each case.
For Private Cloud Compute, Apple's docs expose a quotaUsage property and a PrivateCloudComputeLanguageModel.Error type. Read the quota before long jobs, and when the limit is hit, say so in plain words and offer the on-device model or a later retry. Do not keep retrying silently in a loop.
For Claude, the README says errors that don't map to a Foundation Models LanguageModelError surface as ClaudeError, such as ClaudeError.missingCredential. Framework errors such as guardrails, context length and decoding problems come through the usual Foundation Models error types.
do {
let response = try await session.respond(to: prompt)
show(response.content)
} catch ClaudeError.missingCredential {
showMessage("This feature isn't set up on this device yet.")
} catch {
showMessage("Couldn't finish that request. Try again in a moment.")
log(error)
}
Claude models can also decline requests in some policy areas. The package has a fallbacks: parameter that names up to three other models the API tries in order within the same request, plus a .serverDefault option. The README notes that after a fallback, the conversation's next requests go to the fallback model for about an hour, and you can check entry.claudeModelID to see which model answered. If you track cost or quality per model, log that ID.
You can also set effort. fixedEffort: pins a level for every request and overrides the framework's reasoning hints. The README maps the framework's .light, .moderate and .deep to Claude's low, medium and high, and says the API defaults to high when nothing is sent. Higher effort costs more tokens, so pick it per feature.
What runs on today's SDK, tested on a Mac
The snippets were tried on a Mac with Xcode 26.2 and macOS 26.0.1. That SDK's Foundation Models module has SystemLanguageModel, @Generable and @Guide, but neither the LanguageModel protocol nor PrivateCloudComputeLanguageModel. So the server-model code in Steps 2 and 4 needs the Xcode 27 SDK to compile at all, even if your app keeps iOS 26 as its deployment target and guards that code with #available. If your CI runs an older Xcode, update it before you merge this work.
The ReviewNoteDraft type from Step 5 compiled in the Swift 6 language mode and was sent to the on-device model through a plain LanguageModelSession. Apple Intelligence was turned off on that Mac, which made it a useful test of the failure path:
SystemLanguageModel.default.availabilityreturned.unavailable(.appleIntelligenceNotEnabled), andisAvailablewas false.- Calling
respond(to:generating:)anyway threwLanguageModelSession.GenerationError.assetsUnavailable, with the description "Model is unavailable".
With the error handling from Step 6, that error falls into the last catch and the user reads "Try again in a moment", which is wrong advice, because trying again changes nothing until Apple Intelligence is on. The SDK lists three reasons for an unavailable model, deviceNotEligible, appleIntelligenceNotEnabled and modelNotReady, and each deserves its own message. This helper maps them, and turns the assetsUnavailable error into the same message:
import FoundationModels
func onDeviceMessage() -> String? {
switch SystemLanguageModel.default.availability {
case .available:
return nil
case .unavailable(.deviceNotEligible):
return "This device can't run Apple's on-device model."
case .unavailable(.appleIntelligenceNotEnabled):
return "Turn on Apple Intelligence in Settings to use this feature."
case .unavailable(.modelNotReady):
return "The model is still downloading. Try again later."
case .unavailable:
return "The on-device model isn't available right now."
}
}
func friendlyMessage(for error: Error) -> String {
if let error = error as? LanguageModelSession.GenerationError,
case .assetsUnavailable = error {
return onDeviceMessage() ?? "The on-device model isn't available right now."
}
return "Couldn't finish that request. Try again in a moment."
}
It compiled for macOS and for the iOS 26 Simulator in Swift 6 mode, and on that Mac it printed "Turn on Apple Intelligence in Settings to use this feature." The final case .unavailable catches any reason Apple adds later. The same check is also what chooseRoute in Step 2 relies on, so a device in this state goes straight to Private Cloud Compute or Claude instead of throwing. That is the second row of the test matrix below, and a Mac with Apple Intelligence switched off is an easy way to reproduce it.
Step 7: Get the App Review side right
Switching to a nicer API does not change what App Review checks. Two guidelines cover AI features that send user data off the device.
Guideline 5.1.2(i) says: "You must clearly disclose where personal data will be shared with third parties, including with third-party AI, and obtain explicit permission before doing so." If your Claude or Gemini route sends anything personal (a user's notes, photos, messages, health or location details), show a clear consent screen before the first request that names the provider and says what is sent. A line hidden in the terms of service does not count as explicit permission.
Guideline 5.1.1(i) requires a privacy policy link in App Store Connect and inside the app. The policy must say what data you collect and how you use it, and confirm that third parties you share data with give the same protection. Add each AI provider you route to. Update your App Privacy answers in App Store Connect too, so the product page matches what the app does.
Private Cloud Compute is Apple's own system, and Apple's page says user data is not stored or accessible to Apple or anyone else. Even so, write down which route each feature uses. When a reviewer asks where text goes, you want a one-line answer per feature, and your App Review notes are the place for it.
Last, test on the device type the reviewer will use. App Attest fails on simulators, and Private Cloud Compute depends on Apple Intelligence being available in the device's region. If a reviewer's device can't reach your chosen model and the feature just spins, that can lead to a rejection under guideline 2.1 for an incomplete or broken app. Give every route a working fallback or a clear message.
Step 8: Build a small test matrix
Before you submit, run each AI feature through this grid and note the result:
- A device with Apple Intelligence on: on-device route, Private Cloud Compute route and Claude route each return a decoded result.
- A device with Apple Intelligence off or unsupported: the app picks a different route or shows a message, and never hangs.
- A fresh install with no network on first launch: App Attest fails cleanly and the app recovers when the network returns.
- A TestFlight build: Private Cloud Compute works under the entitlement, and no API key exists anywhere in the build. Search the built app bundle for your key prefix to be sure.
- An older supported iOS version: server-model code is behind
#availableand the old path still works. - The first AI action for a new user: the consent screen appears before any personal data leaves the device.
Run the matrix again after each OS update. Apple's own notes say the system model changes with OS releases, and the Claude package is still in beta.
Quick checklist
- Minimum deployment target written down, with
#available(iOS 27, *)around server-model code. - One function builds every
LanguageModelSession. - Small Business Program status and download count checked; Private Cloud Compute entitlement requested if eligible.
- A migration plan written for the day you pass 2 million first-time downloads.
- Claude added with
.appAttest(clientID:); App Attest entitlement on an explicit App ID. - No API key in the release build, verified by searching the bundle.
- One
@Generabletype per feature, tested on every route. - User-facing messages for quota limits, missing credentials and unavailable models.
- Consent screen before sending personal data to a third-party AI provider, privacy policy and App Privacy answers updated.
- App Review notes say which model each feature uses.
FAQ
Is Private Cloud Compute really free?
For developers in the App Store Small Business Program with fewer than 2 million first-time downloads and the entitlement assigned, Apple says there is no cloud API cost. Usage still has daily limits that Apple does not publish, and Apple says expanded access will cost a fee in the future.
Do I need an Organization developer account for the entitlement?
Apple's page does not say. In the Hacker News thread one developer said an Organization account was needed and another said it worked on a paid Individual account. Apple's published conditions are the Small Business Program, the download threshold and the assigned entitlement, so check the request form for your account.
Can I still use my existing backend proxy with Claude?
Yes. The .proxied(headers:) mode with a baseURL sends requests through your server, which adds the credential. The README says the relay must forward the anthropic-beta header for fallbacks, and the user-profile headers if you use per-user profiles.
Will a key-in-the-app version get rejected?
App Review has no guideline that bans API keys in apps. The problem is that the key can be extracted and abused, and the cost lands on you. Anthropic's own README tells you not to release with a bundled key.
Does the Claude package work on iOS 26?
No. The README lists iOS 27, macOS 27, visionOS 27 or watchOS 27, and the LanguageModel protocol it builds on starts at OS 27.
Can the on-device model handle coding or long documents?
Apple positions Private Cloud Compute as the option with more reasoning and a larger context size. Developers in the Hacker News thread reported that the on-device model has strict guardrails and that even the cloud model struggled with a larger coding task. Test your own prompts before you promise a feature.
If you use Claude Code to build and maintain iOS apps, I put together Claude Code + Xcode: The Production iOS Workflow Kit. It is a ZIP with AGENTS.md and CLAUDE.md templates, 8 rules (including privacy and security and release safety), 6 commands such as /ios-feature and /ios-release, 10 iOS agents, and a runnable SwiftUI and UIKit sample project with tests. It does not cover Foundation Models specifically, and the product page is clear that it cannot guarantee App Store approval.
Keep reading on JR Devhub
Sources
- Apple: Foundation Models framework
- Apple: Accessing Private Cloud Compute
- Apple: Foundation Models updates
- Apple: LanguageModel protocol
- Apple: PrivateCloudComputeLanguageModel
- Apple: SystemLanguageModel.Availability
- Apple: App Store Small Business Program
- Apple: App Review Guidelines (5.1.1, 5.1.2, 2.1)
- Anthropic: ClaudeForFoundationModels on GitHub
- Hacker News discussion, 13 November 2026

Comments