AnyLanguageModel gives Swift apps a shared model interface
Local and hosted models share session APIs, with an important qualification when reasoning history moves between providers.
Changing providers without rewriting session code is AnyLanguageModel's central attraction. Mattt's announcement, published October 20, 2026, presents version 1.0 as a Foundation Models-compatible interface for local and hosted inference.
The article demonstrates an import change and describes local execution through llama.cpp, MLX and Core ML. Hosted options include OpenAI, Anthropic, Google and Hugging Face, with custom base URLs for compatible endpoints.
One detail deserves attention when an app switches models mid-conversation. Reasoning blocks are automatically left out of requests if the destination provider cannot replay them. A shared interface therefore does not imply that every part of a transcript transfers unchanged.
I would use the library to compare a specific task across local and hosted execution, checking structured output and tool calls on each path. For authentication, the API supports a closure that can obtain temporary tokens from the app's server.
It fits Swift developers who need a choice of execution environments. The deciding constraint is how the actual task behaves with each selected provider.
Source: Mattt, AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms.