Introducing swift-huggingface: The Complete Swift Client for Hugging Face
swift-huggingface is a ground-up rewrite of the Swift client for the Hugging Face Hub, replacing swift-transformers' HubApi. It fixes unreliable large-model downloads by building on URLSession download tasks with resume data, accurate progress, and per-file metadata so snapshots only refetch changed files. It also uses a Python-compatible content-addressed cache (blobs keyed by ETag, symlinked snapshots, flock-based locking) shared with the hf CLI. Further additions are an explicit TokenProvider for credential sources, OAuth 2.0 with Keychain storage, full Hub API coverage and Inference Providers, with Xet chunk-deduplicated downloads planned.
Related posts
- Swift Transformers Reaches 1.0 – and Looks to the Future
Hugging Face easyNoviceswift-transformers, Hugging Face's Swift library for running local models on Apple Silicon, reaches 1.0. The release makes Tokenizers and Hub standalone top-level modules and adopts a rewritten swift-jinja for chat templates that is orders of magnitude faster. It also moves to modern Core ML APIs with stateful models for KV caching and MLTensor, drops the CLI targets and the swift-argument-parser dependency, and fully supports Swift 6. The release includes breaking API changes, and future work will focus on MLX integration and agentic use cases including MCP.
- huggingface_hub v1.0: Five Years of Building the Foundation of Open Machine Learning
Hugging Face easyNovicehuggingface_hub reaches v1.0 after five years, with breaking changes. It replaces requests with httpx for HTTP/2, thread-safe connection reuse and a unified sync/async API. It also makes hf_xet the default transfer backend, ships a redesigned Typer-based `hf` CLI that replaces huggingface-cli, and removes legacy pieces like the Git-based Repository class, HfFolder, InferenceApi and hf_transfer. Most libraries work with both v0.x and v1.x, except transformers (v4 needs v0.x, v5 needs v1.x). v0.x will receive only security fixes. The history covers the 2022 shift from Git to the HTTP Commit API with a shared deduplicated cache, and Xet's chunk-level (64KB) deduplication, now used by 77PB+ across 6M+ repositories.
- AnyLanguageModel 1.0: One Year of Local Models on Apple Platforms
Hugging Face mediumAdeptAnyLanguageModel 1.0 is a Swift package that acts as a drop-in replacement for Apple's Foundation Models framework, letting apps swap the model and provider by changing a single import. Over the past year it gained tool calling, guided generation including nested @Generable types, and image support across every provider. It covers local models via llama.cpp, MLX and Core ML as well as hosted APIs (OpenAI, Anthropic, Gemini, Ollama, Hugging Face Inference Providers, Private Cloud Compute), and reasoning blocks are omitted automatically when switching to a provider that can't replay them. API keys now come from a closure so apps can fetch short-lived tokens, the library runs on Linux, and swift-huggingface and swift-xet 1.0 ship alongside it for faster model downloads from the Hub.
- Releasing Swift Transformers: Run On-Device LLMs in Apple Devices
Hugging Face mediumAdeptHugging Face released swift-transformers, an alpha Swift package with a transformers-like API for on-device text generation, along with the swift-chat demo app, updated exporters and transformers-to-coreml conversion tools, and pre-converted Llama 2 7B and Falcon 7B Core ML models. The post walks through converting Llama 2 to Core ML via three routes: the no-code Space, exporters, or raw coremltools. Lessons from those conversions include using coremltools 7.0b1, dropping softmax from outputs, and using fixed sequence lengths, because flexible shapes only run on the CPU. Planned optimizations are KV caching, discrete input shapes and palettization or mixed-bit quantization, and the library already supports Hub-configured BPE tokenizers plus greedy and top-k generation.
- Introducing AnyLanguageModel: One API for Local and Remote LLMs on Apple Platforms
Hugging Face mediumAdeptAnyLanguageModel is a Swift package that mirrors Apple's Foundation Models API, so a single `import` swap lets apps target Apple's system model, Core ML, MLX, llama.cpp, Ollama, or cloud providers (OpenAI, Anthropic, Gemini, Hugging Face Inference Providers) through the same session-based interface. Building on Foundation Models rather than a new abstraction keeps the API minimal and familiar. Swift 6.1 package traits let developers opt in only to the heavy local backends they need. The library already extends the API with image inputs for vision-language models, and tool calling, MCP and guided generation across providers are planned before 1.0.