AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms
AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms Published October 20, 2026 Last November, AnyLanguageModel was introduced as a drop in replacement for Apple's...
By Software Development Team
AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms
Published October 20, 2026
Last November, AnyLanguageModel was introduced as a drop-in replacement for Apple's Foundation Models framework. It allows developers to choose the model and provider used by an app while preserving the Foundation Models programming interface.
The project was created in response to app developers interested in local models but uncertain how to begin, as well as developers seeking to avoid the complexity of supporting multiple inference providers. Local and hosted inference each serve different purposes, and a shared API makes it easier to select an appropriate model for each task.
After a year and dozens of releases, AnyLanguageModel 1.0 is now available, alongside swift-huggingface 1.0 and swift-xet 1.0.
A drop-in compatible API
The central idea remains unchanged: use the Foundation Models API with the model that best fits an application. To get started, change the import statement:
- import FoundationModels
+ import AnyLanguageModel
The same session code can then work with the system model, open-weight models through llama.cpp, MLX, and Core ML, as well as supported hosted providers.
Major additions over the past year include:
- Tool calling, supported by every provider.
- Guided generation, also supported by every provider, including nested
@Generabletypes and arrays of those types. - Image support, which allows images to be attached to prompts using Foundation Models 27 syntax. This also works with the system model on iOS, macOS, and visionOS 27.
On OS 27, AnyLanguageModel works with any model conforming to Foundation Models' LanguageModel protocol, including models from Core AI.
The related swift-huggingface and swift-xet projects provide accelerated model downloads from the Hub for Swift applications.
Hosted models
Hosted-model support also expanded. AnyLanguageModel now supports:
- OpenAI's Chat Completions and Responses APIs
- Open Responses, for providers with compatible endpoints
- Anthropic's Messages API, including adaptive thinking and effort options
- Google's Gemini API
- Ollama
- Private Cloud Compute on OS 27
- Hugging Face Inference Providers
- Other OpenAI-compatible endpoints, including OpenRouter, through a custom base URL
Inference Providers can be used for open-weight models that are too large to run on a device, while retaining the same session code:
let model = OpenAILanguageModel(
baseURL: URL(string: "https://router.huggingface.co/v1/")!,
apiKey: ProcessInfo.processInfo.environment["HF_TOKEN"]!,
model: "openai/gpt-oss-120b",
apiVariant: .chatCompletions
)
Hosted providers support the same capabilities as local models, including guided generation, streaming tool calls, and token usage information in responses.
Reasoning is now included in the transcript. When switching providers, reasoning blocks are automatically excluded from requests if the new provider cannot replay them.
API keys are supplied through a closure rather than a string, allowing an application to obtain short-lived tokens from its own server. The project's security guidance describes when users can provide their own keys and when requests should instead be routed through a proxy.
AnyLanguageModel also runs on Linux, allowing the same code to be used on a server.
Open-weight models have become more capable
As local models have become easier to use, the models themselves have also improved. Smaller models can be a practical starting point. Examples of highly downloaded models on the Hub include:
- Gemma 4 E2B from Google, available in GGUF and approximately 3.4 GB at
Q4_0with quantization-aware training. - LFM2.5 2.6B from Liquid AI, available in GGUF and approximately 1.7 GB at
Q4_K_M. - Qwen3.8 27B for MLX from Alibaba, approximately 16 GB at 4 bits.
The first two models fit on an iPhone. Qwen3.8 27B runs on a Mac with 32 GB of memory or more. Selecting the MLX model requires one line:
let model = MLXLanguageModel(modelId: "mlx-community/Qwen3.8-27B-4bit")
GLM-5.3 from Z.ai requires approximately 1.5 TB in BF16, which can be accommodated by four fully configured Mac Studios. It is also available through Inference Providers.
Upgrading to 1.0
A Swift Package Manager dependency can be declared as follows:
dependencies: [
.package(
url: "https://github.com/huggingface/AnyLanguageModel",
from: "1.0.0",
traits: ["MLX"]
)
]
Applications upgrading from an earlier release should consult the migration guidance in the AnyLanguageModel, swift-huggingface, and swift-xet 1.0 release notes.
What's next
Language models are one way to add intelligent behavior to products, but they are only one category of model developers can use. The next stage is to apply the same approach to additional capabilities: familiar Swift APIs combined with a choice of models that run on the device.
Planned areas include models that make decisions and models that process audio.