
Hugging Face Blog
· 1 min read
Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms
LLMs have become essential tools for building software. But for Apple developers, integrating them remains unnecessarily painful.
Developers building AI-powered apps typically take a hybrid approach, adopting some combination of:
- Local models using Core ML or MLX for privacy and offline capability
- Cloud providers like OpenAI or Anthropic for frontier capabilities
- Apple's Foundation Models as a system-level fallback
Each comes with different APIs, different requirements, different integration patterns. It's a lot, and it adds up quickly. When I interviewed developers about building AI-powered apps, friction with model integration came up immediately. One developer put it bluntly:
I thought I'd quickly use the demo for a test and maybe a quick and dirty build but instead wasted so much time. Drove me nuts.
The cost to experiment is high, which discourages developers from discovering that local, open-source models might actually work great for their use case.
Today we're announcing AnyLanguageModel, a Swift package that provides a drop-in replacement for Apple's Foundation Models framework with support for multiple model providers. Our goal is to reduce the friction of working with LLMs on Apple platforms and make it easier to adopt open-source models that run locally.
The Solution
The core idea is simple:
Swap your import statement, keep the same API.
- import FoundationModels
+ import AnyLanguageModel
Here's what that looks like in practice. Start with Apple's built-in model:
let model = SystemLanguageModel.default
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Explain quantum computing in one sentence")
print(response.content)
Now try an open-source model running locally via MLX:
let model = MLXLanguageModel(modelId: "mlx-community/Qwen3-4B-4bit")
let session = LanguageModelSession(model: model)
let response = try await session.respond(to: "Explain quantum computing in one sentence")
print(response.content)
The app includes:
Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


