Vibeleaderboard
← All Intel
Intel / article

AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms

Source
huggingface.co
Date

Context

AnyLanguageModel is a Swift package from Hugging Face that keeps the API of Apple's Foundation Models framework, the interface apps use to call Apple's built-in model, while letting the app choose which model and provider actually answer (Hugging Face blog). A developer changes one import statement, from FoundationModels to AnyLanguageModel, and the same session code then works with Apple's system model, with models through llama.cpp, MLX and Core ML, or with hosted providers. When the project was introduced last November, Hugging Face explained that it built on Apple's API rather than inventing a new abstraction partly because every Swift developer targeting Apple platforms will encounter it, so building on it means less conceptual overhead (introduction).

At that launch the package was pre-1.0, and the remaining work it listed included across all providers and guided generation for structured outputs. Version 1.0, released after a year and dozens of releases, closes those gaps: the post says tool calling and guided generation now work with every provider, the latter including nested @Generable types and arrays of them. Images can be attached to prompts using Foundation Models 27's syntax, including with the system model on iOS, macOS and visionOS 27, and on OS 27 the package also works with any model that conforms to Foundation Models' LanguageModel protocol, including Core AI models. Hosted providers get the same features as local models, namely guided generation, tool calling with and token usage, across OpenAI's Chat Completions and Responses APIs, Anthropic's Messages API, Google's Gemini API, Apple's Private Cloud Compute on OS 27, and OpenAI-compatible endpoints such as OpenRouter or Hugging Face Providers through a custom base URL. Reasoning is now kept in the transcript, and when an app switches providers, reasoning blocks are left out of requests if the new provider cannot replay them.

The post pairs the release with the observation that small open-weight models have become a good place to start. Among the most downloaded models on the Hub it names Gemma 4 E2B from Google (about 3.4 GB at Q4_0) and LFM2.5 2.6B from Liquid AI (about 1.7 GB at Q4_K_M), both of which it says fit on an iPhone, and an MLX build of Alibaba's Qwen3.8 27B (about 16 GB at 4 bits) that runs on a Mac with 32 GB of memory or more. Open-weight models too big for the device, such as Z.ai's GLM-5.3 at about 1.5 TB in BF16, can be reached through Inference Providers with the same session code. Hugging Face also released 1.0 versions of swift-huggingface and swift-xet, which it built alongside AnyLanguageModel to bring accelerated model downloads from the Hub to Swift apps.

Key takeaways · AI-distilled
  • When an app switches providers mid-conversation, AnyLanguageModel keeps reasoning in the transcript but automatically omits reasoning blocks from requests to a provider that cannot replay them.
  • API keys are supplied through a closure rather than a string, so an app can fetch short-lived tokens from its own server instead of shipping a long-lived key. The README covers when to proxy requests and when to let people bring their own keys.
  • Hugging Face Inference Providers and other OpenAI-compatible endpoints such as OpenRouter plug in through a custom base URL, so the same session code can call open-weight models too large for the device, such as gpt-oss-120b.
  • Among the most downloaded Hub models the post lists, Gemma 4 E2B (about 3.4 GB at Q4_0) and LFM2.5 2.6B (about 1.7 GB at Q4_K_M) fit on an iPhone, while Qwen3.8 27B for MLX (about 16 GB at 4 bits) needs a Mac with 32 GB of memory or more.
  • The library also runs on Linux, so the same Swift code can serve requests from a server, and on OS 27 it accepts any model that conforms to Foundation Models' LanguageModel protocol, including Core AI models.
Terms in this piece · Glossary
  • open weights — A model whose trained parameters are published for anyone to download and run — unlike API-only models you can access but never possess.
  • tool use — A model's ability to call external functions — run code, search the web, edit files — instead of only generating text.
  • streaming — Sending a model's response token by token as it is generated, so the reader sees text immediately instead of waiting for the whole answer.
  • inference — Running a trained model to get answers — the phase where AI is actually used, as opposed to trained.
Read the source huggingface.co
Recommended reads
Comments

Checking sign-in…

Loading comments…