ToolsNews
AnyLanguageModel 1.0 brings any model to Apple's Swift API
Hugging Face has released AnyLanguageModel 1.0, a Swift package that keeps Apple's Foundation Models API but lets you swap the model underneath: llama.cpp, MLX or Core ML on device, or OpenAI, Anthropic, Gemini and HF Inference Providers in the cloud.
By: Mikola Máté Patrik · · 3 min read

What changed
Hugging Face introduced AnyLanguageModel last November. The idea is simple: keep the API of Apple's Foundation Models framework, but let the app developer pick the model. A year and dozens of releases later, 1.0 is out, together with swift-huggingface 1.0 and swift-xet 1.0 (Hugging Face).
Switching takes one line: replace import FoundationModels with import AnyLanguageModel. The same session code then works with the system model, with open-weight models running on llama.cpp, MLX and Core ML, and with hosted providers.
What was added this year
- Tool calling and guided generation with every provider, including nested @Generable types and arrays of them.
- Image attachments in prompts using Foundation Models 27 syntax, including with the system model on iOS, macOS and visionOS 27.
- On OS 27, any model that conforms to the Foundation Models LanguageModel protocol, including Core AI models.
- Hosted support for OpenAI Chat Completions and Responses, Open Responses, Anthropic Messages (with adaptive thinking and effort options), the Gemini API, Ollama, Private Cloud Compute (OS 27), HF Inference Providers, and other OpenAI-compatible endpoints such as OpenRouter through a custom base URL.
- Reasoning is now part of the transcript. When you switch providers, reasoning blocks are dropped automatically if the new provider can't replay them.
- API keys come from a closure instead of a string, so apps can fetch short-lived tokens from their own server.
- It runs on Linux, so the same code can work on a server.
Which models to start with
HF highlights three of the most downloaded models on the Hub right now. Google's Gemma 4 E2B in GGUF is about 3.4 GB at Q4_0 with quantization-aware training. Liquid AI's LFM2.5 2.6B in GGUF is about 1.7 GB at Q4_K_M. Both fit on an iPhone. Alibaba's Qwen3.8 27B for MLX is about 16 GB at 4 bits and needs a Mac with at least 32 GB of memory. Models too big for the device, such as the roughly 1.5 TB GLM-5.3, are reachable through Inference Providers with the same code.
Why it matters for developers
If you build AI features for Apple platforms, one API now covers local and hosted models, with no separate integration per provider. In Swift Package Manager you need from: "1.0.0" plus the trait you want (for example MLX). For existing apps, check the migration notes in the three packages' release notes (GitHub). HF says the next step is the same kind of Swift API for models that decide and models that listen.
Produced with the help of AI, reviewed by an editor. How we make our articles
Reviewed and edited by the Neural Daily desk. About


