Apple's Foundation Models framework, unveiled at WWDC 2026, gave Swift developers a unified API for running AI on device. The framework handles session management, streaming, guided generation, and client-side tool use through a single LanguageModelSession object. Apple's own small model handles the lightweight tasks that fit comfortably on a phone's neural engine. For queries that demand deeper reasoning or live information, the framework was designed to accept server-side models. Anthropic became the first external provider to ship one, releasing ClaudeForFoundationModels on June 9.

The package is available as an open-source Swift Package Manager dependency at github.com/anthropics/ClaudeForFoundationModels. It makes Claude Sonnet 4.6, Claude Opus 4.8, and other models in the API available as conforming implementations of Apple's LanguageModel protocol. Because the conformance is complete, nothing in the application layer needs to know whether a given session is routing to Apple's model or to Anthropic's infrastructure. The respond(to:) call returns the same type either way. Streaming snapshots look the same. Structured outputs using @Generable work without modification.

Key Facts

  • PackageClaudeForFoundationModels (Apache 2.0, open source)
  • Supported OSiOS 27, macOS 27, iPadOS 27, visionOS 27, watchOS 27 (all beta)
  • Session APILanguageModelSession — same as Apple's on-device model
  • Structured output@Generable annotation with compile-time capability checks
  • Server-side toolsWeb search, web fetch, code execution
  • StatusBeta — API may change before OS 27 general availability

Same Session, Different Scale

Anthropic's documentation frames the intended split between the two model types plainly: Apple's on-device model for fast, private, offline tasks; Claude for queries that need larger context windows, frontier reasoning, or access to server tools that run on Anthropic's infrastructure. The switching logic is a conditional on the model reference passed to LanguageModelSession, not a refactor of session management code. A developer who starts building with Apple's model and later decides certain queries need more capability changes the model: argument and a package dependency. The session logic, data flow, and UI binding stay the same.

That design choice matters more than it might appear. Prototype paths and production paths frequently diverge when a developer adds a remote API midway through a project, because the integration shape changes. Here it does not. The package targets this directly: its documentation includes a runnable command-line example that streams a chat turn with optional web search enabled, and the repository is structured so that developers can start from a working example rather than wiring a new SDK from scratch.

The package currently supports .sonnet4_6 and .opus4_8 as compiled-in model constants, with each constant carrying a declaration of the model's capabilities, such as which effort levels it accepts, whether it supports image input, and whether structured output is available. Passing a model constant to the session initializer means the package can validate requests at construction time rather than failing at runtime on an unsupported field.

"Escalate to Claude when you need larger context, frontier reasoning, or server-side tools such as web search and code execution. Because both use the same LanguageModelSession API, you can switch by swapping the model: argument." Anthropic documentation, June 2026

Server Tools and Automatic Caching

One feature unavailable through Apple's on-device model is server-side tooling. The serverTools: parameter on ClaudeLanguageModel adds web search, web fetch, or code execution to a session. These run on Anthropic's infrastructure within a single round trip, so there is no device-side callback or additional networking code required. Results surface in the session transcript as ClaudeServerToolSegment custom segments, which can be rendered inline or processed in the app's data layer. Web search and web fetch both accept optional domain allow-lists and block-lists, as well as a cap on the number of tool uses per request.

Prompt caching runs automatically when Claude processes a long context. Developers do not configure it directly, and cache TTL or breakpoint placement are not exposed through Apple's protocol. That is a deliberate tradeoff: keeping the surface area consistent with what Apple's own model does means developers do not need to track a separate set of options when switching between providers. Requests go from the app directly to the Claude API; Apple is not in the path and does not see prompts or responses.

Production Deployment and Auth

During development, an API key passes to ClaudeLanguageModel via the auth: .apiKey(...) parameter. For production apps, Anthropic's documentation is direct: a key bundled in a shipped binary is extractable from that binary, and anyone who extracts it can generate charges against the account. The proxy mode, .proxied(headers:), routes requests through a developer-controlled backend. That backend appends the Claude API credential before forwarding to Anthropic, and a custom header from the app authorizes the caller. The binary ships with no key; the credential management lives in the developer's own infrastructure.

The package sits in beta alongside the OS 27 betas, and the server-side language model API it depends on may change before iOS 27 ships to consumers in the fall. Anthropic is not accepting external pull requests during the beta period, but the GitHub issue tracker is open.

This is the third notable Claude integration in the Apple ecosystem this WWDC cycle. Xcode 27 gained agentic coding features powered by the Claude Agent SDK, and iOS 27's Siri extension layer lets Claude respond inside system-level UI. The Foundation Models package operates a level lower than either, aimed at developers building apps rather than using them, and it is the first that makes Anthropic's newest models available as drop-in components inside Apple's own AI framework.

Further reading: Learn more about Claude's model family, read our background on Anthropic, or browse the latest Claude AI news.