Claude for Foundation Models
Swift package that lets Apple apps use Claude as a server-side language model through the Foundation Models framework.
At a Glance
Swift package that conforms Claude to Apple's Foundation Models LanguageModel protocol, licensed under Apache 2.0. Using Claude requires a separate Anthropic credential (App Attest client ID or API key), whose usage costs are external.
Engagement
Available On
Listed Oct 2026
About Claude for Foundation Models
Claude for Foundation Models is a Swift package from Anthropic that conforms Claude to Apple's Foundation Models LanguageModel protocol. Developers drive Claude with the same LanguageModelSession API they use for Apple's on-device model, including respond(to:), streaming, guided generation, and tool calling. The README labels it a beta that targets the server-side language model API introduced in the OS 27 betas, so APIs may change before general availability.
What It Is
The package is a provider integration for Apple's Foundation Models framework, not a general-purpose Anthropic Messages API client. Its public surface is ClaudeLanguageModel, ClaudeModel, AuthMode, and ClaudeServerTool. An app creates a ClaudeLanguageModel with a model name and credential, passes it to a LanguageModelSession, and uses the session as it would with any other Foundation Models provider.
Model Selection and Behavior
Models are chosen with compiled-in ClaudeModel constants that mirror API model IDs, or with a custom ID plus explicitly declared capabilities. Each model declares the sampling parameters, effort levels, thinking, structured output, and image input it accepts, and the bridge uses this to decide which request fields to send. A fixed effort level can be pinned per model, and the framework's reasoning levels map to Claude effort levels. Up to three fallback models can be named, so a request that a model declines in certain policy areas is retried on the next model within the same request.
Authentication Options
There are three modes. App Attest registers the app in the Anthropic console, so each install proves it is a genuine copy and the app ships no key. API keys are intended for simulator development. A proxied mode routes requests through the developer's own backend, which adds the credential server-side. An optional user profile ID can attribute requests to individual end users.
Streaming, Structured Output and Server Tools
Streaming returns cumulative snapshots. Types annotated with @Generable can be requested through generating: for structured output. Server-side tools (web search, web fetch, and code execution) run on Anthropic's infrastructure within a single round trip and are configured per model, with domain filters and usage limits for search and fetch. Tool activity appears in transcript entries so apps can render it inline. Provider errors that do not map to Foundation Models errors surface as ClaudeError.
Setup Path
It is added through Swift Package Manager or Xcode and requires iOS, macOS, visionOS, or watchOS 27 (beta) and Xcode 27 (beta). A runnable command-line example streams a chat turn to the terminal and can enable web search. The package is licensed under Apache 2.0, and the README says it is maintained on a best-effort basis and does not accept external contributions.
Community Discussions
Be the first to start a conversation about Claude for Foundation Models
Share your experience with Claude for Foundation Models, ask questions, or help others learn from your insights.
Pricing
Open Source (Apache 2.0)
Swift package that conforms Claude to Apple's Foundation Models LanguageModel protocol, licensed under Apache 2.0. Using Claude requires a separate Anthropic credential (App Attest client ID or API key), whose usage costs are external.
- Apache License 2.0
- Swift package for Apple Foundation Models framework
- Streaming, guided generation and tool calling support
- Beta: targets OS 27 betas; APIs may change
- Requires Anthropic credential (external cost)
Capabilities
Key Features
- Conforms Claude to Apple's Foundation Models LanguageModel protocol
- Works with LanguageModelSession respond(to:)
- Streaming responses as cumulative snapshots
- Structured output with @Generable types
- Client-side tool calling via the framework
- Server-side tools: web search, web fetch, code execution
- Fixed effort levels and reasoning-level mapping
- Fallback models for declined requests
- App Attest, API key, and proxied authentication
- User profile attribution for requests
- Custom model IDs with declared capabilities
- ClaudeError error handling
