apple-foundation-models changedcli-sdks-libraries/libraries/apple-foundation-models
Nearest release: v2.1.334, published 11 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+18added
Lines−19removed
From line
43
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits20to this page, all time
### Developer API key (development) ### API key (development)
The whole hunk
from line 43, old and new numbered
/
from line 43
4343
4444* iOS 27, macOS 27, visionOS 27, or watchOS 27 (all in beta): the OS releases whose Foundation Models framework supports server-side language models
4545* Xcode 27 (beta)
46* A Claude API key from the [Claude Console](https://platform.claude.com/) for development. See [Authentication](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/apple-foundation-models#authentication) for production options.
46* To ship: [App Attest, or a proxy on your own back end](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/apple-foundation-models#authentication)
47* To develop without App Attest, which doesn’t work in the Simulator: a [Developer API key scoped to one workspace](https://platform.claude.com/docs/en/manage-claude/api-keys#scope) from the [Claude Console](https://platform.claude.com/)
4748
4849## Install the package
4950
from line 89
8889
8990## Choosing a model
9091
91Model identifiers are values of `ClaudeModel`. Use a compiled-in constant, or construct one with explicit capabilities for an ID that isn’t compiled in yet (see [Capabilities](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/apple-foundation-models#capabilities)):
92Model identifiers are values of `ClaudeModel`. Use a compiled-in constant, or construct one with explicit capabilities for an ID that isn’t compiled in (see [Capabilities](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/apple-foundation-models#capabilities)):
9293
9394```swift
9495ClaudeLanguageModel(name: .opus5_5, auth: auth)
from line 142
141142)
142143```
143144
144<Note>
145 App Attest requires a physical device. The Simulator, and hardware without a Secure Enclave, cannot perform App Attest. Use `.apiKey` while iterating in the Simulator, and `.appAttest` when running on a device.
146</Note>
145App Attest requires a physical device. The Simulator and hardware without a Secure Enclave can’t perform it. Use `.apiKey` while iterating in the Simulator and `.appAttest` when running on a device.
147146
148147To set up App Attest, you need your Apple Developer Team ID and the admin role in your Claude Console organization. Configure your Xcode project and register your app in the [Claude Console](https://platform.claude.com/):
149148
from line 173
174173ClaudeLanguageModel(
175174 name: .sonnet5,
176175 auth: .proxied(headers: ["X-App-Token": "..."]),
177 baseURL: URL(string: "https://api.yourapp.com/claude")!
176 baseURL: URL(string: "https://api.example.com/claude")!
178177)
179178```
180179
181Your proxy receives standard [Messages API](https://platform.claude.com/docs/en/api/messages/create) requests, attaches your API key as `Authorization: Bearer <key>`, and forwards them to `https://api.anthropic.com`.
180Your proxy receives standard [Messages API](https://platform.claude.com/docs/en/api/messages/create) requests and attaches a [Workload Identity Federation](https://platform.claude.com/docs/en/manage-claude/workload-identity-federation) access token or a Developer API key as `Authorization: Bearer <credential>`. It forwards them to `https://api.anthropic.com`.
182181
183### API key (development)
182### Developer API key (development)
184183
185Pass an API key directly while developing:
184<Warning>
185 Anyone can extract the key from a shipped app and make requests billed to your account. Use `.apiKey` only in development, and switch to App Attest or a proxy before release.
186</Warning>
186187
188Pass a [Developer API key scoped to one workspace](https://platform.claude.com/docs/en/manage-claude/api-keys#scope):
189
187190```swift
188191ClaudeLanguageModel(name: .sonnet5, auth: .apiKey("YOUR_API_KEY"))
189192```
190193
191<Warning>
192 A key bundled into an app is extractable from the shipping binary, and anyone who extracts it can make requests billed to your account. Use `.apiKey` for development only, and switch to App Attest or a proxy before release.
193</Warning>
194
195194## Streaming
196195
197196`streamResponse(to:)` returns the response incrementally. Each element is a cumulative snapshot of the response so far, not a delta:
from line 263
264263 let response = try await session.respond(to: prompt)
265264 print(response.content)
266265} catch ClaudeError.missingCredential {
267 // Prompt for an API key.
266 // Prompt for a Developer API key.
268267} catch let error as LanguageModelError {
269268 // Framework-shaped errors (rate limits, guardrails, context-window overflow, decoding).
270269} catch {
No line in this hunk matches that.