foundation-models
Installation
SKILL.md
FoundationModels — On-Device LLM
Apple's framework for on-device generative AI. No cloud, no API keys, full privacy.
Critical Constraints
- ❌ DO NOT use
response.output→ ✅ Useresponse.contentto access generated values - ❌ DO NOT skip availability check → ✅ Always check
SystemLanguageModel.default.availabilityfirst - ❌ DO NOT exceed 4,096 tokens per session → ✅ Break large tasks into multiple sessions
- ❌ DO NOT send concurrent requests on same session → ✅ Check
session.isRespondingfirst - ❌ DO NOT confuse with OpenAI/Anthropic APIs → ✅ This is Apple's native framework, different API surface
Availability Check (Required)
import FoundationModels
let model = SystemLanguageModel.default