AnyLanguageModel 1.0 release notes
Unified API for Local and Hosted Models
AnyLanguageModel 1.0 provides a drop-in compatible API that allows developers to switch between system models, open-weight models (via llama.cpp, MLX, and Core ML), and various hosted providers by changing a single import statement. By replacing import FoundationModels with import AnyLanguageModel, developers gain access to a consistent session code that abstracts away the underlying inference provider. This version also introduces support for Linux, enabling the same code to run on server-side environments.
Expanded Feature Set and Provider Support
The 1.0 release introduces several cross-provider capabilities designed to simplify the integration of intelligent features into Swift applications:
- Tool Calling: Now supported across all providers.
- Guided Generation: Works universally, including support for nested
@Generabletypes and arrays. - Image Support: Enables image attachment to prompts using Foundation Models 27 syntax, compatible with system models on iOS, macOS, and visionOS 27.
- Reasoning Management: The API automatically handles reasoning blocks in transcripts, omitting them when switching to providers that do not support them.
- Security: API keys are now handled via closures rather than static strings, allowing apps to fetch short-lived tokens from secure servers.
AnyLanguageModel 1.0 expands its hosted model support to include OpenAI, Anthropic (with adaptive thinking support), Google Gemini, Ollama, Private Cloud Compute (on OS 27), and Hugging Face Inference Providers.
Ecosystem Integration
Alongside the core library, Hugging Face has released swift-huggingface 1.0 and swift-xet 1.0 to facilitate accelerated model downloads from the Hugging Face Hub directly into Swift applications. The framework is also compatible with Apple's LanguageModel protocol, allowing it to work with Core AI models on OS 27.
For developers utilizing open-weight models, the framework supports local execution of models like Google's Gemma 4 E2B, Liquid AI's LFM2.5 2.6B, and Alibaba's Qwen3.8 27B. These models can be integrated with minimal code changes, such as using MLXLanguageModel for MLX-optimized models.