Choose a provider

The provider is one line of makeAgent. Domains, guards, undo, and UI stay the same when you change it. This page is the decision; each provider page has the detail.

Start direct

.anthropic(apiKey:), .openAI(apiKey:), and .gemini(apiKey:) talk straight to the vendor API. One key, any model string — the fast start. But the key travels from the device on every request, so direct providers are for prototyping, not shipped client apps. Detail: Anthropic, OpenAI, Gemini.

Sampling controls — temperature, top-p, and max tokens — are not exposed on makeAgent or send for the direct providers in this version; they are a provider-author concern (SamplingConfig). AgentKit Cloud sets the output ceiling server-side through the tier's maxOutputTokens.

Ship a profile

.backendRouterCloud(...) names an agent profile; AgentKit Cloud resolves the provider, model, system prompt, and tool schemas server-side. No key and no model name in the binary. This is the production path — go to production walks the switch, AgentKit Cloud covers auth and attestation.

Stay on the device

.appleFoundationModels() runs Apple's system model with no key and no network — conversation content stays on the device. It is a small model: a context window around 4K tokens and a 20-tool ceiling, so scope domains tightly. Requires macOS 26+ / iOS 26+ / visionOS 26+. Detail: on-device with Apple.

Route through your own server

.backendRouter(endpoint:headers:) streams through a backend you already run: your server forwards the request to any LLM and re-emits normalized events; tools still execute on-device. Detail: your own backend.

Bring your own model

Implement AgentProvider for anything else — a local model server, a vendor AgentKit doesn't ship, a scripted double for tests. Detail: bring your own model.

Compare

Direct AgentKit Cloud Your backend Apple on-device
Where the key lives in the app — extractable server-side server-side no key
Model choice any model string, chosen in app code server-side profile (agent id + tier) your server decides Apple's system model
Network required required required none
Vision yes the profile's model decides your backend decides OS 27+ (model-reported); on OS 26 images degrade to text descriptors
Structured output OpenAI and Gemini yes; Anthropic no no opt-in (your backend declares it) yes
Best for prototyping shipping client apps existing server infra privacy, offline