Skip to content
Main Site News Console

AnyLanguageModel 1.0: A Year in Review of Local Models on Apple Platforms

· Hugging Face Translated
教程模型卡

Last November, we introduced AnyLanguageModel on this blog: a drop-in replacement for Apple’s Foundation Models framework that lets you freely choose the model and provider powering your app. We heard from many app developers that while they were eager to explore local models, they often didn’t know where to start—and they wanted to avoid the extra complexity of supporting multiple inference providers. AnyLanguageModel was born out of that feedback. Both local and cloud-hosted inference have their strengths, and each plays an important role in building the next generation of intelligent applications. A unified API makes picking the right model for each task effortless.

After a year of development and dozens of releases, AnyLanguageModel 1.0 is officially here, alongside swift-huggingface 1.0 and swift-xet 1.0.

Here is what’s new in this release and what’s coming next:

A Drop-In Compatible API

The core philosophy of AnyLanguageModel remains unchanged: keep the Foundation Models API, use whatever model fits your app. To get started, simply update your import statement:

import FoundationModels
import AnyLanguageModel

The exact same conversation code works with system models, open-weight models running via llama.cpp, MLX, and Core ML, as well as the hosted providers listed below.

Over the past year, we have added several key features:

  • Tool calling across all providers.
  • Guided generation across all providers as well, including nested @Generable types and arrays of them.
  • Image support, allowing you to attach images to prompts using Foundation Models 27 syntax, including when using system models on iOS, macOS, and visionOS 27.

On OS 27, AnyLanguageModel is also compatible with any model conforming to Foundation Models’ LanguageModel protocol, including Core AI models.

Alongside AnyLanguageModel, we also built swift-huggingface and swift-xet to bring accelerated model downloads from the Hugging Face Hub to Swift applications.

Hosted Models, Too

Support for hosted models has expanded this year as well. AnyLanguageModel now supports:

  • OpenAI’s Chat Completions and Responses APIs
  • Open Responses (for any provider offering a compatible endpoint)
  • Anthropic’s Messages API, with support for adaptive thinking and effort options
  • Google’s Gemini API
  • Ollama
  • Private Cloud Compute (for OS 27)
  • Hugging Face Inference Providers, as well as other OpenAI-compatible endpoints like OpenRouter via custom base URLs

With Inference Providers, you can use the same conversation code to run open-weight models that are too large to run locally on-device:

let model = OpenAILanguageModel(
baseURL: URL(string: "https://router.huggingface.co/v1/")!,
apiKey: ProcessInfo.processInfo.environment["HF_TOKEN"]!,
model: "openai/gpt-oss-120b",
apiVariant: .chatCompletions
)

Hosted providers feature the same capabilities as local models: guided generation, tool calling with streaming support, and token usage statistics in responses.

Reasoning is now part of the transcript as well. When switching providers, reasoning blocks are automatically omitted from requests if the new provider cannot reproduce them.

API keys are now supplied via closures rather than fixed strings, allowing your app to dynamically fetch short-lived tokens from your own backend. The README covers when to let users bring their own keys (BYOK) versus when to route requests through a proxy.

AnyLanguageModel also runs on Linux, meaning the same code can run on the server side.

Open-Weight Models Got Better

While we’ve lowered the barrier to using local models, the models themselves have also gotten significantly better, making smaller models a fantastic entry point. Here are some of the most downloaded models on the Hub today:

  • Gemma 4 E2B from Google, in GGUF format with quantization-aware training (QAT), weighing in around 3.4 GB at Q4_0.
  • LFM2.5 2.6B from Liquid AI, in GGUF format, around 1.7 GB at Q4_K_M.
  • Qwen3.8 27B for MLX from Alibaba, around 16 GB in 4-bit.

The first two models can run on an iPhone, while Qwen3.8 27B runs on a Mac with 32 GB or more of memory. Loading this MLX model takes just a single line of code:

let model = MLXLanguageModel(modelId: "mlx-community/Qwen3.8-27B-4bit")

If you happen to have four fully loaded Mac Studios on hand, GLM-5.3 from Z.ai in BF1