A Terminal User Interface (TUI) application for searching, browsing, and downloading models from the HuggingFace model hub. Features both an interactive TUI mode and a CLI mode for automation.


Clone this repository:
git clone https://github.com/JohannesBertens/rust-hf-downloader.git
Build:
cargo build --release
Run the application:
cargo run --release
Install:
cargo install rust-hf-downloader
Run:
rust-hf-downloader
See: rust-hf-downloader on crates.io
The application supports a CLI mode for automated/CI environments without TUI.
# Basic search
rust-hf-downloader --headless search "llama"
# With filters
rust-hf-downloader --headless search "gpt" \
--min-downloads 10000 \
--min-likes 100
# JSON output for scripting
rust-hf-downloader --headless --json search "stable diffusion" | \
jq '.results[] | select(.downloads > 50000) | .id'
# Download specific quantization
rust-hf-downloader --headless download \
"TheBloke/llama-2-7b-GGUF" \
--quantization "Q4_K_M" \
--output "/models"
# Download all files
rust-hf-downloader --headless download \
"meta-llama/Llama-3.1-8B" \
--all \
--output "/models"
# Dry run (show what would be downloaded)
rust-hf-downloader --headless --dry-run download \
"TheBloke/llama-2-7b-GGUF" \
--quantization "Q4_K_M"
# List GGUF quantizations
rust-hf-downloader --headless list "TheBloke/llama-2-7b-GGUF"
# List all files for non-GGUF model
rust-hf-downloader --headless list "bert-base-uncased"
# Resume all incomplete downloads
rust-hf-downloader --headless resume
--headless - Run in CLI mode (required for CLI commands)--json - Output in JSON format (for scripting)--token <TOKEN> - HuggingFace authentication token--dry-run - Show what would be done without executing-h, --help - Show help messagesearch - Search for models
rust-hf-downloader --headless search <QUERY>
[--sort <downloads|likes|modified|name>]
[--min-downloads <N>]
[--min-likes <N>]
download - Download a model
rust-hf-downloader --headless download <MODEL_ID>
[--quantization <TYPE>]
[--all]
[--output <DIR>]
Note: If an invalid quantization is specified or no quantization is provided for a GGUF model, the error message will display all available quantizations with file counts and sizes to help you choose correctly.
list - List available files
rust-hf-downloader --headless list <MODEL_ID>
resume - Resume incomplete downloads
rust-hf-downloader --headless resume
0 - Success1 - Download/API error2 - Authentication error (gated model requires token)3 - Invalid argumentsname: Download Model
on: [push]
jobs:
download:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/cargo@v1
with:
command: install
args: rust-hf-downloader
- name: Download model
env:
HF_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }}
run: |
rust-hf-downloader --headless download \
"meta-llama/Llama-3.1-8B" \
--all \
--output "./models" \
--token "$HF_TOKEN"
FROM rust:1.75-slim
RUN cargo install rust-hf-downloader
# Set default download directory
ENV HF_HUB_CACHE=/models
ENTRYPOINT ["rust-hf-downloader", "--headless"]
docker run --rm \
-v /path/to/models:/models \
-e HF_TOKEN=your_token_here \
rust-hf-downloader \
download "meta-llama/Llama-3.1-8B" --all --output "/models"
CLI mode respects the same configuration file as TUI mode:
~/.config/jreb/config.tomlExample config:
default_directory = "/models"
concurrent_threads = 8
num_chunks = 20
download_rate_limit_enabled = true
download_rate_limit_mbps = 50.0
For gated models, provide your HuggingFace token. The application performs an early authorization check before starting downloads:
# Via CLI flag
rust-hf-downloader --headless download "model-id" \
--token "hf_..." \
--quantization "Q4_K_M"
# Via config file
# Add to ~/.config/jreb/config.toml:
# hf_token = "hf_..."
Note: If you attempt to download a gated model without authentication, the application will:
This early check prevents multiple authorization errors during download attempts.
| Key | Action |
|---|---|
/ | Open search popup |
o | Toggle options screen (configure settings) |
Tab | Switch focus between Models and Quantizations lists |
d | Download selected quantization (when Quantizations list is focused) |
v | Verify SHA256 hash of downloaded file (when Quantizations list is focused) |
Enter | Execute search (in search popup) / Show details (in browse mode) / Edit directory (in options) |
Esc | Close search popup / Cancel popup / Close options |
j or ↓ | Move selection down in focused list / Navigate options down |
k or ↑ | Move selection up in focused list / Navigate options up |
+ | Increment numeric option value (in options screen) / Increment focused filter |
- | Decrement numeric option value (in options screen) / Decrement focused filter |
Space | Toggle boolean option (in options screen) |
q or Ctrl+C | Quit application |
| Action | Effect |
|---|---|
| Click on panel | Focus that panel and select first item |
| Scroll in panel | Navigate up/down in the focused panel |
| Hover over panel | Highlight panel border (cyan) |
| Click on filter field | Focus field and cycle to next value |
| Scroll on filter field | Cycle filter value up/down |
Mouse-supported panels:
| Key | Action |
|---|---|
s | Cycle sort field (Downloads → Likes → Modified → Name) |
S (Shift+s) | Toggle sort direction (Ascending ↔ Descending) |
f | Cycle focus between filter fields |
+ or → | Increment focused filter value |
-, _ or ← | Decrement focused filter value |
r | Reset all filters to defaults |
1 | Preset: No Filters (default) |
2 | Preset: Popular (10k+ downloads, 100+ likes) |
3 | Preset: Highly Rated (1k+ likes) |
4 | Preset: Recent (sorted by last modified) |
Ctrl+S | Save current filter settings as defaults |
| Key | Action |
|---|---|
Y | Resume all incomplete downloads |
N | Skip incomplete downloads |
D | Delete incomplete files and skip |
Start the application
Y to resume incomplete downloadsN to skip and continueD to delete incomplete filesSearch for models - Press '/' to search
Configure settings (optional) - Press o to open options screen
j/k+/- (including download speed limit in MB/s)+/- or Space (including rate limiting enable/disable)For gated models (Llama-3.1, Llama-2, etc.):
o to open options, navigate to "HuggingFace Token", press Enter, paste token, press Enter againType your query (e.g., "gpt", "llama", "mistral")
Press Enter to search
Navigate model results with j/k or arrow keys (Models list is focused by default, yellow border)
View quantization details automatically as you select different models
[downloaded] indicator shows files you already havePress Tab to switch focus to the Quantizations list (yellow border moves)
Navigate quantizations with j/k or arrow keys
Press d to download the selected quantization:
~/models{path}/{author}/{model-name}/{filename}v to verify a downloaded file (if SHA256 hash is available):Press Enter to see full details of the selected item in the status bar
Press Tab again to return focus to the Models list
Press / to start a new search
The Quantization Details section shows all available GGUF quantized versions with:
[downloaded] indicator if already on disk/ → type gpt → Enter/ → type stable-diffusion → Enter/ → type translation → Enterhttps://huggingface.co/api/models)~/models/hf-downloads.toml)The application queries the HuggingFace API with the following parameters:
rust-hf-downloader/
├── Cargo.toml # Dependencies and project metadata
├── README.md # This file
├── changelog/ # Release notes for all versions
└── src/
├── main.rs # Entry point
├── models.rs # Data structures & types
├── config.rs # Configuration persistence (v0.9.0)
├── utils.rs # Formatting utilities
├── api.rs # HuggingFace API client with auth (v0.9.5)
├── http_client.rs # Authenticated HTTP requests (v0.9.5)
├── registry.rs # Download registry persistence
├── download.rs # Download manager & security
├── rate_limiter.rs # Token bucket rate limiter (v1.2.0)
├── verification.rs # SHA256 verification worker
└── ui/
├── mod.rs # UI module declaration
├── app.rs # Module re-exports (v0.9.5)
├── app/ # App submodules (v0.9.5)
│ ├── state.rs # AppState initialization
│ ├── events.rs # Event handling
│ ├── models.rs # Model browsing logic
│ ├── downloads.rs # Download management
│ └── verification.rs # Verification UI
└── render.rs # TUI rendering logic
Version 0.7.0 introduces a modular architecture with clear separation of concerns:
Version 0.9.5 further refines the architecture:
ratatui: TUI frameworkcrossterm: Terminal manipulationtokio: Async runtimereqwest: HTTP client with streaming supportserde: JSON serializationtui-input: Text input widgetcolor-eyre: Error handlingtoml: TOML serialization for download metadataregex: Multi-part filename pattern matchingurlencoding: URL-safe query encodingfutures: Async stream utilitiessha2: SHA256 hash calculationhex: Hex encoding for hash displayonce_cell: Lazy static initialization for rate limiterKey security features in v0.6.0:
| Version | Date | Summary |
|---|---|---|
| [1.4.0] | 2026-02-13 | Optimized verification progress with AtomicU64 and cache Entry API |
| [1.3.2] | 2026-01-21 | Exact model match for repository ID searches |
| [1.3.1] | 2026-01-21 | Added F16 and TQ quantization support |
| [1.2.2] | 2026-01-08 | Fixed color contrast on light terminals |
| [1.2.1] | 2026-01-07 | Download progress shows total remaining size |
| [1.2.0] | 2026-01-07 | Download speed rate limiting (token bucket) |
| [1.1.1] | 2025-12-16 | Fixed GGUF path duplication for subdirectories |
| [1.0.0] | 2025-11-27 | Removed trending models, search-only startup |
| [0.9.7] | 2025-11-25 | Fixed file path handling bugs |
| [0.9.5] | 2025-11-25 | HuggingFace token authentication for gated models |
| [0.9.0] | 2025-11-25 | Persistent configuration system with options screen |
| [0.8.0] | 2025-11-23 | SHA256 hash verification system |
| [0.7.5] | 2025-11-23 | Adaptive chunk sizing for downloads |
| [0.7.0] | 2025-11-21 | Complete modular architecture overhaul |
| [0.6.2] | 2025-11-21 | Switched to rustls for TLS |
| [0.6.0] | 2024-11-21 | Fixed path traversal vulnerability |
See changelog/README.md for detailed release notes.
Copyright (c) Johannes Bertens
This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT)
1 activity