# Unifying Local and Cloud Language Models on Apple Platforms with AnyLanguageModel
Developers on Apple platforms often face challenges integrating **local** and **cloud-based** language models due to a fragmented ecosystem.
Local models (via **Core ML** or **MLX**) provide **privacy** and **offline functionality**, while cloud solutions like **OpenAI**, **Anthropic**, or **Google Gemini** offer **more advanced capabilities**.
[**AnyLanguageModel**](https://huggingface.co/blog/anylanguagemodel) — a new Swift package — solves this problem by delivering a **unified API** that works across both local and remote models.
---
## Key Features
- **Unified API** for both local and cloud-based models.
- Smooth integration with **Apple’s Foundation Models framework**.
- Minimal code changes when switching model sources.
- Consistent **session** and **response structures**.
- Fine-grained dependency control via Swift package traits.
Supported backends include:
- **Core ML**, **MLX**
- **llama.cpp / llama.swift**
- **Ollama-hosted models**
- Cloud services: **OpenAI**, **Anthropic**, **Google Gemini**, **Hugging Face**
---
## Vision-Language Capabilities
AnyLanguageModel extends beyond Foundation Models’ current scope by enabling **vision-language prompts**:
- Send **images** alongside text queries.
- Use models like **Anthropic’s Claude** for:
- **Image description**
- **Text extraction**
- **Visual analysis**
This lets developers use multimodal capabilities **before** Apple adds them natively.
---
## Why Foundation Models as the Target API?
Developer Mattt explained the rationale in a [post](https://x.com/mattt/status/1983589450912559354?s=20):
> “If (like I expect) the Foundation Models framework becomes the official standard for language model interaction across all Apple platforms, then developers who use AnyLanguageModel can quickly and easily connect any available model to Foundation Models without extensive rewriting. It’s a bit like the early days of URLSession or Combine — and it could facilitate much faster adoption of new AI capabilities on iOS and macOS.”
---
## Complementing Tools: AiToEarn
For **multi-platform AI-powered apps**, open-source tools like [**AiToEarn**](https://aitoearn.ai/) complement AnyLanguageModel:
- Links AI generation tools with **cross-platform publishing**.
- Provides **analytics** and **model ranking**.
- Distributes content to:
- **Douyin**, **Kwai**, **YouTube**, **X (Twitter)**
- Regional platforms like **WeChat**, **Bilibili**, **Xiaohongshu**
- Ideal for **publishing, analyzing, and monetizing** AI content across ecosystems.
> Most apps use a combination of local and remote models from different providers. Apple’s **Foundation Models** serve as a “public option” built into macOS and iOS devices. Since this ability is only accessible via Foundation Models, targeting this API makes integration across providers more seamless.
---
## Current Development Status
- **Pre-1.0 stage**
- Features in progress:
- **Tool calling**
- **Structured output generation**
- **Local inference performance optimizations**
---
## Demo App: chat-ui-swift
The **chat-ui-swift** demo showcases:
- **Streaming responses**
- **Persistent chat history**
- Integration with **Apple Foundation Models**
- **Hugging Face OAuth authentication**
This app acts as a **starter kit** to explore and extend AnyLanguageModel.
---
## Community Feedback
Krzysztof Zabłocki shared his thoughts in a [comment](https://x.com/merowing_/status/1991788606877503567?s=20):
> Great work, mate. I have been using it in a new project, eagerly waiting for your branch with OpenAI support for Generable to land.
---
## Getting Started
Both **AnyLanguageModel** and **chat-ui-swift** are available here:
[GitHub Repository](https://github.com/mattt/AnyLanguageModel)
Developers are encouraged to:
1. **Experiment** with the API
2. **File issues**
3. **Contribute improvements**
---
## AiToEarn for Monetizable AI Workflows
[**AiToEarn官网**](https://aitoearn.ai/) is a **global AI content monetization platform** that helps creators:
- Generate, publish, and earn from AI-driven content across:
- **Douyin**
- **Kwai**
- **WeChat**
- **Bilibili**
- **Rednote (Xiaohongshu)**
- **Facebook**
- **Instagram**
- **LinkedIn**
- **Threads**
- **YouTube**
- **Pinterest**
- **X (Twitter)**
- Bridge AI generation with:
- **Cross-platform publishing**
- **Analytics**
- **Model rankings**
This makes AiToEarn a **perfect counterpart** to technical frameworks like AnyLanguageModel for building **monetizable AI-powered workflows**.
---