AnyLanguageModel swaps one import to unify Core ML, MLX, and cloud LLMs on Apple devices
Curated by the Inblix editorial team
iOS and macOS developers building AI features face a messy reality: local models use Core ML or MLX APIs, cloud providers like Anthropic demand their own SDKs, and Apple’s Foundation Models framework sits somewhere in between. Mattt, the developer behind AnyLanguageModel, heard the frustration directly from devs. One told him, “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.”
AnyLanguageModel, a new Swift package announced today, tackles this by acting as a drop-in replacement for Apple’s own Foundation Models API. Change your import from FoundationModels to AnyLanguageModel, and the same LanguageModelSession code can now target MLX, Core ML, llama.cpp, Ollama, or cloud services like OpenAI and Google Gemini. The pitch is simple: make the core API a stable, lowest-common-denominator abstraction so switching backends requires minimal code changes.
Mattt deliberately chose Apple’s API as the baseline rather than inventing a new universal abstraction. He argues Foundation Models is well-designed and intentionally limited, which keeps the package grounded without piling on leaky abstractions. It’s a pragmatic bet that every Swift developer on Apple platforms will eventually know this interface, reducing conceptual overhead.
Under the hood, the package uses Swift 6.1’s new package traits to avoid dependency bloat. You opt into only the backends you need—say, just MLX—and the default installation pulls in nothing heavier than URLSession networking for cloud providers. Xcode projects that can’t declare traits directly get a workaround via a thin internal package wrapper. The library also supports image inputs, though the API design for that capability is still evolving alongside Apple’s own vision-related types.
💡 Key Takeaways
- AnyLanguageModel uses Apple's Foundation Models API as a stable template rather than creating yet another LLM abstraction layer, which directly reduces the learning curve for Swift developers already targeting Apple platforms.
- Developers can experiment with local open-source models by changing a single line of code, lowering the cost of discovering that a quantized MLX model might handle their use case just fine without touching the cloud.
- Swift 6.1 package traits solve the dependency bloat problem that plagues multi-backend AI tools—you only compile the backends you actually use, and the default install pulls in no local inference engines at all.
Keep reading: See related articles below for more coverage on this topic.
Get smarter about AI
The sharpest AI news, curated daily. Delivered free to your inbox.