core-ai
Core AI: On-Device AI Models
Overview
Core AI runs AI models on device inside your app. Inference stays private, works
offline, and has no per-inference cost. You start from a .aimodel file (converted
from a model or already in the correct format) that contains one or more named
inference functions, bundle it, load it as an AIModel, and run those functions
over NDArray tensors (image inputs use a pixel-buffer value).
Available on Apple Intelligence devices: iPhone/iPad with A17 Pro or later, Mac
with M1 or later, Apple Vision Pro (M2+). Building requires the Metal Toolchain
in Xcode (not installed by default) — without it, builds that include .aimodel
files fail with a missing Metal compiler error.
Core AI runs your own model files at the tensor level. For Apple's high-level on-device LLM API (chat sessions, tool calling, guided generation), use the Foundation Models framework — a separate framework, not covered here.