←新闻详情

Hugging Face更新于 10月25日 21:59

Hugging Face 发布 AnyLanguageModel 1.0,统一 Apple 平台本地与托管模型调用

AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms

AI 导读

Hugging Face 发布 AnyLanguageModel 1.0,用同一套会话代码即可调用系统模型、llama.cpp、MLX、Core ML 的开放权重模型以及多家托管服务商。该版本让工具调用和引导生成覆盖所有服务商,支持在提示词中附带图片,并新增对 Anthropic Messages API、Gemini API、Ollama、Private Cloud Compute 和 Hugging Face Inference Providers 的支持。文中还列出 Gemma 4 E2B、LFM2.5 2.6B、Qwen3.8 27B 等当前下载量较高的模型及其量化后体积。

推荐理由

AI 评分 54

原文梳理了 AnyLanguageModel 1.0 在本地与托管模型间统一调用、工具调用和引导生成上的能力变化,便于开发者判断迁移成本。

主题

标签

正文

A drop-in compatible API

The same session code then works with the system model, with open-weight models through llama.cpp, MLX, and Core ML, and with the hosted providers below.

Over the past year, we've added several major features:

Tool calling works with every provider.

Guided generation works with every provider, too, including nested @Generable types and arrays of them.

Image support lets you attach images to prompts using Foundation Models 27's syntax, including when you use the system model on iOS, macOS, and visionOS 27.

On OS 27, AnyLanguageModel also works with any model that conforms to Foundation Models' LanguageModel protocol, including Core AI models.

Alongside AnyLanguageModel, we've built out swift-huggingface and swift-xet to bring accelerated model downloads from the Hub to Swift apps.

Hosted models, too

Support for hosted models expanded this year, too. AnyLanguageModel now supports:

Open Responses , for any provider with a compatible endpoint

Anthropic's Messages API, with adaptive thinking and effort options

Google's Gemini API

Ollama

Private Cloud Compute, on OS 27

Hugging Face Inference Providers , and other OpenAI-compatible endpoints such as OpenRouter, through a custom base URL

With Inference Providers, you can use open-weight models that are too big to run on the device with the same session code:

Hosted providers get the same features as local models: guided generation, tool calling with streaming, and token usage on responses.

Reasoning is now part of the transcript too. When you switch providers, reasoning blocks are automatically omitted from requests if the new provider can't replay them.

API keys come from a closure instead of a string, so your app can fetch short-lived tokens from your own server. The README explains when to let people bring their own keys and when to route requests through a proxy.

AnyLanguageModel also runs on Linux, so the same code can work on a server.

Open-weight models got better

While we've made local models easier to use, the models themselves have become more capable, making the small ones a good place to start. Here are some of the most downloaded models on the Hub right now:

Gemma 4 E2B from Google, in GGUF, about 3.4 GB at Q4_0 with quantization-aware training.

LFM2.5 2.6B from Liquid AI, in GGUF, about 1.7 GB at Q4_K_M .

Qwen3.8 27B for MLX from Alibaba, about 16 GB at 4 bits.

The first two fit on an iPhone, and Qwen3.8 27B runs on a Mac with 32 GB of memory or more. Selecting the MLX model takes one line:

And if you have four maxed-out Mac Studios handy, GLM-5.3 from Z.ai takes about 1.5 TB in BF16. For the rest of us, it's available through Inference Providers.

Upgrading to 1.0

If you're upgrading an existing app, see the migration guidance in the AnyLanguageModel , swift-huggingface , and swift-xet release notes for help updating your code.

Community feedback and contributions have shaped several of our major features. Thank you to everyone who contributed for helping make AnyLanguageModel more useful to app developers.

What's next

Language models have proven to be a powerful tool for building intelligence into products. They're also one of many kinds of models developers can put to work. We're excited to bring the same approach to more capabilities: familiar Swift APIs with a choice of models running on the device. Coming soon: models that decide, and models that listen.

Links

AnyLanguageModel on GitHub

swift-huggingface on GitHub

swift-xet on GitHub

Introducing AnyLanguageModel

Introducing swift-huggingface

Models mentioned in this article 4

LiquidAI/LFM2.5-2.6B-GGUF

google/gemma-4-E2B-it-qat-q4_0-gguf

mlx-community/Qwen3.8-27B-4bit

zai-org/GLM-5.3

More Articles from our Blog

Jun Kim, oMLX creator and maintainer, joins Hugging Face to support the MLX community

+1

The PR you would have opened yourself

Models mentioned in this article 4

LiquidAI/LFM2.5-2.6B-GGUF

google/gemma-4-E2B-it-qat-q4_0-gguf

mlx-community/Qwen3.8-27B-4bit

zai-org/GLM-5.3

来源

Hugging Face