Claude for Foundation Models
Anthropic's Swift package that plugs Claude into Apple's Foundation Models API, so the same session, streaming and tool-calling code can use Claude.
View on GitHub ↗- Stars
- ★ 325
- Last commit
- 7 Oct 2026
- Maintenance
- Active
- Licence
- Apache-2.0
- Category
- On-device AI SDKs
- GitHub
- anthropics/ClaudeForFoundationModels
Overview
Claude for Foundation Models is a Swift package from Anthropic that lets you use Claude as a server-side language model through Apple's Foundation Models framework. You create a ClaudeLanguageModel and use it with LanguageModelSession like any other Foundation Models provider. It's for app developers who want Claude's models behind Apple's standard API.
Features
- ClaudeLanguageModel plugs into LanguageModelSession
- Streaming responses with streamResponse(to:)
- Structured output with @Generable types
- Choice of Claude models, effort levels and fallbacks for declined requests
- App Attest authentication for production, or an API key for simulator development
- Per-user attribution through Anthropic user profiles
Requirements
- iOS 27, macOS 27, visionOS 27 or watchOS 27 (beta)
- Xcode 27 (beta)
- An App Attest client ID from the Anthropic console, or an API key for simulator development
- The bundled example needs a macOS 27 host
Install
Add the package to Package.swift, or use File > Add Package Dependencies in Xcode
.package(url: "https://github.com/anthropics/ClaudeForFoundationModels.git", from: "0.1.0")Import it alongside FoundationModels
import FoundationModels import ClaudeForFoundationModels
Example
Create a ClaudeLanguageModel, pass it to a LanguageModelSession and ask it to "Plan a 4-day trip to Buenos Aires."
Works with
Listed in
- github.com/anthropics/ClaudeForFoundationModels
- raw.githubusercontent.com/anthropics/ClaudeForFoundationModels/HEAD/README.md
Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.