huggingface/hf-hub

Rust client for the huggingface hub aiming for minimal subset of features over `huggingface-hub` python package

What it solves

It provides a typed, ergonomic Rust interface for interacting with the Hugging Face Hub API, serving as the Rust equivalent of the popular huggingface_hub Python library. This allows Rust developers to manage AI models, datasets, and spaces without needing a Python environment.

How it works

The library provides two primary interfaces: an asynchronous HFClient (using tokio) and a synchronous HFClientSync (enabled via the blocking feature). It interacts with the Hub API to perform operations on repositories, files, commits, branches, and user profiles. It also supports high-performance transfers via the Xet storage backend and provides a command-line tool called hfrs for terminal-based Hub interaction.

Who it’s for

Rust developers building AI applications or infrastructure who need to programmatically interact with the Hugging Face Hub to download models, upload datasets, or manage repository metadata.

Highlights

  • Comprehensive Hub Operations: Supports creating, deleting, and updating repositories, as well as managing files, commits, and branches.
  • Dual Interface: Offers both async and blocking synchronous calls for flexibility in different Rust runtimes.
  • Streaming Pagination: Uses async streams for memory-efficient iteration over list endpoints.
  • Wasm Support: Compiles for wasm32-unknown-unknown, allowing Hub interaction within WebAssembly environments (via streaming downloads and HTTP-only methods).
  • CLI Tool: Includes hfrs, a dedicated command-line interface for the Hub.

Related

  • Project
  • Dispatch
  • Project
  • Dispatch
  • Project