AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms
** AnyLanguageModel 1.0 unifies local and hosted LLM inference on Apple platforms via the Foundation Models API, adding tool calling, guided generation, and image support across all providers. The release ships with swift‑huggingface 1.0 and swift‑xet 1.0 for accelerated model downloads, and expands hosted support to OpenAI, Anthropic, Private Cloud Compute, and Hugging Face‑compatible endpoints. Notable model downloads include Gemma 4 E2B (3.4 GB, Q4_0), LFM2.5 2.6B (1.7 GB, Q4_K_M), and Qwen3.8 27B (16 GB, 4‑bit) that run on iPhone and Mac respectively, enabling engineers to start with small on‑device models and fall back to larger remote models with identical session code. **KeyTakeaways:** - AnyLanguageModel now supports tool calling and guided generation with every provider, including nested @Generable types.
⚡ Key Takeaways
- AnyLanguageModel now supports tool calling and guided generation with every provider, including nested @Generable types.
- Image attachment uses Foundation Models 27 syntax and works on iOS, macOS, and visionOS 27.
- Hosted providers (OpenAI, Anthropic, Private Cloud Compute, Hugging Face Inference, OpenRouter) receive the same features as local models, including streaming tool calls and token usage reporting.
- API keys are supplied via a closure, allowing short‑lived token retrieval from a server or proxy.
- The framework runs on Linux, enabling identical code paths for server‑side inference.
** Engineers can now write a single Swift session that seamlessly swaps between on‑device and cloud LLMs, reducing integration overhead while leveraging the latest model capabilities for both latency‑critical and compute‑heavy tasks.
✅ Practical Steps
- Replace your import with `import AnyLanguageModel` to enable the unified API.
- Use the same session code to switch between system, llama.cpp, MLX, Core ML, or any hosted provider (e.g., OpenAI Chat Completions).
- Provide API keys via a closure (as shown in the README) to fetch short‑lived tokens from your backend.
Want the full story? Read the original article.
Read on Hugging Face Blog ↗