AnyLanguageModel 1.0 Released for Apple Platforms

At a Glance
| Item | Value |
|---|---|
| Publisher | Hugging Face Blog |
| Published | 2026-10-20 |
| License | Apache-2.0 |
| Source type | Unverified (not confirmed by a primary source) |
Values determined by this site’s code when the information was collected. Dates are JST.
Overview
The information introduced in this article has not been officially confirmed and is currently based on unconfirmed reports.
It is reported that “AnyLanguageModel 1.0", a Swift library that allows integrated use of open-weight models and various cloud APIs for Apple platforms, has been released. This library is designed as a drop-in replacement compatible with Apple’s official Foundation Models framework. It is reported that by simply replacing the import statement in the code, developers can switch between local inference engines and external API providers while keeping the same session code. Additionally, the release of “swift-huggingface 1.0" and “swift-xet 1.0", which accelerate model downloads from the Hugging Face Hub, has also been announced.
According to the blog post reported to be the source, development of this project has continued in response to feedback from developers struggling with how to deploy local models or wanting to avoid the complexity of implementing support for multiple inference providers. After one year since its initial release, it has reached major version 1.0, incorporating feature enhancements to make practical use of both local and hosted inference, such as guided generation supporting structured outputs, tool calling, image input, transcript management of the inference process, and support for Linux environments.
Specifications
While this announcement concerns an inference framework rather than a language model itself, the supported runtimes, platforms, and open-weight models listed as verified targets in the documentation are as follows:
- Supported local inference engines: llama.cpp, MLX, Core ML
- Supported hosted providers: OpenAI (Chat Completions and Responses API), Open Responses-compatible endpoints, Anthropic (Messages API, supporting adaptive thinking and effort options), Google Gemini API, Ollama, Private Cloud Compute (OS 27 environment), Hugging Face Inference Providers, and OpenAI-compatible endpoints such as OpenRouter
- Supported platforms: iOS, macOS, visionOS 27, Linux
- API compatibility: Conforms to the LanguageModel protocol of Apple’s Foundation Models framework (including Core AI models in OS 27)
- Open-weight models mentioned in the documentation:
- Gemma 4 E2B (Google, GGUF format, Q4_0 quantization) – LFM2.5 2.6B (Liquid AI, GGUF format, Q4_K_M quantization) – Qwen3.8 27B (Alibaba, MLX format, 4-bit quantization) – GLM-5.3 (Z.ai, BF16)
Performance
Benchmark scores and detailed numerical comparison tables with other environments are not included in the documentation. However, the publishers report that the performance of open-weight models themselves has improved remarkably, significantly increasing the practicality of small models running on-device. According to the documentation, lightweight models such as Gemma 4 E2B and LFM2.5 2.6B are said to run on iPhones, while Qwen3.8 27B is described as running on Mac environments equipped with 32 GB or more of memory.
Furthermore, specifications regarding token processing performance and behavior during inference execution are clarified in the documentation. In MLX and llama.cpp, token counts are aggregated per generation round, and reused prompt tokens are reported as cached inputs. On the other hand, due to the specification of resetting the model state, Core ML is said to process the number of cached tokens as zero. Regarding token conversion in multimodal inputs, it is reported that accurate measurements tailored to the internal implementation of each engine are performed, such as llama.cpp counting including native image chunk tokens, whereas MLX directly adopts the number of prepared input tokens.
Strengths and Use Cases
AnyLanguageModel 1.0 excels at flexibly switching and operating between local and cloud inference without requiring major code rewrites in application development for Apple platforms. A major feature is that it adopts an API structure compatible with the Foundation Models framework provided by Apple, allowing developers to support various models and execution bases simply by replacing import statements in existing Swift code.
The main features and use cases envisioned by this library are as follows:
- Tool calling and streaming across all providers: Tool calling can be used across all providers, including not only local inference engines like llama.cpp, MLX, and Core ML, but also external hosted APIs. It supports multi-round tool execution and allows response generation combined with streaming processing.
- Advanced guided generation (structured output): It supports guided generation, which restricts outputs to fixed formats such as JSON. Because nested
@Generabletypes and their array definitions can be handled directly, type-safe outputs can be stably obtained even when generating complex data models. - Multimodal processing with image input: Following the syntax of Foundation Models 27, attaching images to prompts is supported. Input processing for multimodal-compatible models, including system models on iOS, macOS, and visionOS 27, can be written within the same framework.
- Flexible handover of the inference process: The reasoning process of the inference model is preserved as part of the transcript. If the destination provider does not support replaying reasoning blocks when switching providers, a specification is provided to automatically exclude reasoning blocks from the request before sending.
- Detailed token usage tracking: Token counts for a single response (
response.usage) and cumulative token counts for the entire session (session.usage) can be obtained via a unified interface. Input tokens, cached input tokens, output tokens, and reasoning tokens are counted individually, enabling detailed aggregation complying with Foundation Models 27 specifications. - Secure credential management: API keys can be passed as a closure rather than a fixed string. This makes it easy to implement secure designs, such as dynamically acquiring and using short-lived temporary tokens from a custom authentication server.
- Cross-platform support: Beyond Apple platforms, operation in Linux environments is also supported, making it suitable for running the same logic as client-side apps on server-side Swift.
How to Get It
AnyLanguageModel 1.0 is released as open source (Apache-2.0 license) and can be incorporated into projects using Swift Package Manager (SPM).
It can be used by adding the following dependency to the project’s Package.swift:
dependencies: [
.package(url: "https://github.com/huggingface/AnyLanguageModel", from: "1.0.0")
]
When using the MLX backend, traits can be specified in the dependency definition:
dependencies: [
.package(
url: "https://github.com/huggingface/AnyLanguageModel",
from: "1.0.0",
traits: ["MLX"]
)
]
When using it in code, replace the standard import statement as follows:
import AnyLanguageModel
When loading a local model in MLX format, the model can be specified in a single line like this:
let model = MLXLanguageModel(modelId: "mlx-community/Qwen3.8-27B-4bit")
Also, when using a remote model via OpenAI-compatible endpoints such as Hugging Face Inference Providers, configure the provider as follows:
let model = OpenAILanguageModel(
baseURL: URL(string: "https://router.huggingface.co/v1/")!,
apiKey: ProcessInfo.processInfo.environment["HF_TOKEN"]!,
model: "openai/gpt-oss-120b",
apiVariant:.chatCompletions
)
As auxiliary libraries to accelerate model download processing, version 1.0 of swift-huggingface and swift-xet are also provided. For procedures when upgrading from existing applications, migration guides are posted in the release notes of each repository.
Related Articles
- LFM2.5-VL-3B-DSpark Draft Model for Vision-Language Models: 4GB+ VRAM
- Run GGUF Models Directly in Transformers with llama.cpp Support
- BotPsy: 0.8B On-Device Agentic Model by Tether AI Research
- Mistral Large 4 Released: Multimodal MoE Model
Sources
- AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms (Hugging Face Blog)
- Apple Developer Documentation – LanguageModelSession.Usage
This article contains unverified information. We will append an update note once it is confirmed by a primary source.

