
Hugging Face Blog
· 1 min read
Introducing swift-huggingface: The Complete Swift Client for Hugging Face
Today, we're announcing swift-huggingface, a new Swift package that provides a complete client for the Hugging Face Hub.
You can start using it today as a standalone package,
and it will soon integrate into swift-transformers as a replacement for its current HubApi implementation.
The Problem
When we released swift-transformers 1.0 earlier this year, we heard loud and clear from the community:
- Downloads were slow and unreliable. Large model files (often several gigabytes) would fail partway through with no way to resume. Developers resorted to manually downloading models and bundling them with their apps — defeating the purpose of dynamic model loading.
- No shared cache with the Python ecosystem.
The Python
transformerslibrary stores models in~/.cache/huggingface/hub. Swift apps downloaded to a different location with a different structure. If you'd already downloaded a model using the Python CLI, you'd download it again for your Swift app. - Authentication is confusing. Where should tokens come from? Environment variables? Files? Keychain? The answer is, "It depends", and the existing implementation didn't make the options clear.
Introducing swift-huggingface
swift-huggingface is a ground-up rewrite focused on reliability and developer experience. It provides:
- Complete Hub API coverage — models, datasets, spaces, collections, discussions, and more
- Robust file operations — progress tracking, resume support, and proper error handling
- Python-compatible cache — share downloaded models between Swift and Python clients
- Flexible authentication — a
TokenProviderpattern that makes credential sources explicit - OAuth support — first-class support for user-facing apps that need to authenticate users
- Xet storage backend support (Coming soon!) — chunk-based deduplication for significantly faster downloads
Let's look at some examples.
Flexible Authentication with TokenProvider
The auto-detection follows the same conventions as the Python huggingface_hub library:
Original source
This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.
Read the full story on huggingface.co


