hf-hub

Rust client for the Hugging Face Hub API with async and blocking interfaces

SDK
Cargo
v1.0.0
334 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
77 /100 Good
Development Activity 84
Maintenance 64
Community 80
Maturity 52
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
71 /100 Good
Architecture 76
Code Quality 78
Innovation 70
Learning Curve 60

hf-hub is a typed, ergonomic Rust client for the Hugging Face Hub API, serving as the Rust equivalent of the Python huggingface_hub library. It covers repository, file, commit, branch/tag, bucket, and user/organization operations against the Hub, including support for Hugging Face’s high-performance Xet storage backend.

The crate ships both an async interface (HFClient) built on tokio and reqwest, and a synchronous interface (HFClientSync) for callers that don’t want to manage their own async runtime, alongside a companion hfrs CLI for terminal-based Hub interaction.

What You Get

  • Async (HFClient) and blocking (HFClientSync) client interfaces that mirror each other method-for-method
  • Repository operations: query/create/delete/update/move models, datasets, and spaces
  • File and commit operations including streaming uploads, downloads, and revision diffs
  • Streaming pagination via impl Stream<Item = Result<T>> for memory-efficient async listing
  • Support for Hugging Face’s Xet high-performance transfer backend and bucket storage operations

Common Use Cases

  • Downloading model weights and dataset files from the Hugging Face Hub in a Rust application
  • Automating repository and branch/tag management for models hosted on the Hub
  • Building Rust ML tooling (e.g. inference servers) that needs to fetch artifacts from the Hub at runtime
  • Scripting Hub operations via the bundled hfrs CLI instead of the Python huggingface-cli
  • Uploading large model files efficiently using Xet-backed transfers

Under The Hood

Architecture - The repo is a Cargo workspace (hf-hub, hfrs CLI, benches, examples, integration-tests) where the hf-hub crate exposes HFClient (async, default) and HFClientSync (blocking, feature-gated) that both delegate to shared request-building logic in client.rs, with domain modules split by resource: repository/, buckets/, spaces.rs, users.rs, and a dedicated xet.rs for Hugging Face’s high-throughput transfer protocol. Tech Stack - Built on reqwest for HTTP, tokio for async execution, bon for builder-pattern request construction, serde/serde_json for (de)serialization, and thiserror for structured error types, targeting Rust 2024 edition. Code Quality - The workspace separates unit tests colocated with modules from a dedicated integration-tests crate covering blocking calls, bucket sync/streaming/Xet transfers, downloads, and caching, indicating deliberate coverage of both the sync and async surfaces against real Hub behavior. API Design - The parallel HFClient/HFClientSync design lets callers pick sync or async without learning two different APIs, and the builder-style request pattern (.model(...).info().send().await?) keeps call sites readable, though the breadth of resource types (repos, buckets, spaces, users) means newcomers need to learn several submodules to use the client fully.

Used by 6 apps in this directory

Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
TypeScript
64%
Other

Epicenter

Developer Tools · Knowledge Management · Note Taking

4,808

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
64
Dependency
Built with
TypeScript 64%
HTML 13%
Svelte 13%
Updated 5 days ago
Python
82%
Apache 2.0

headroom

AI Development · Developer Tools

73,966

Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.

View details
85
Repo Health
86
Technical
69
Dependency
Built with
Python 82%
Rust 12%
Updated 5 days ago
Rust
43%
Apache 2.0

LanceDB

AI Development · Databases

11,544

Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).

View details
90
Repo Health
86
Technical
71
Dependency
Built with
Rust 43%
Python 25%
HTML 23%
Updated 5 days ago
Rust
100%
Other

Meilisearch

Search

59,424

Lightning-fast hybrid search engine with AI-powered semantic and full-text retrieval for modern applications.

View details
89
Repo Health
88
Technical
68
Dependency
Built with
Rust 100%
Updated 1 weeks ago
Rust
71%
Apache 2.0

mesh-llm

AI Agents · AI Development

3,463

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
84
Repo Health
91
Technical
69
Dependency
Built with
Rust 71%
TypeScript 13%
Python 10%
Updated 4 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers