huggingface-cli
Manage and interact with Hugging Face Hub
TLDR
Login to Hugging Face Hub
Display the name of the logged in user
Log out
Print information about the environment
Download files from an repository and print out the path (omit filenames to download entire repository)
Upload an entire folder or a file to Hugging Face
Scan cache to see downloaded repositories and their disk usage
Delete the cache interactively
SYNOPSIS
huggingface-cli [-h] [--version] [-v] command [args]
where command is one of: login, logout, whoami, scan-cache, delete-cache, env, repo
PARAMETERS
login
Log in to Hugging Face Hub using token or browser
logout
Log out and clear authentication token
whoami
Display current authenticated user info
scan-cache
Scan and list local cache contents
delete-cache
Delete specific cache entries by repo or pattern
env
Print relevant environment variables
repo
Subcommands for repo management (create, ls, info, etc.)
--token
HF token for authentication (global for some cmds)
-v, --verbose
Increase output verbosity
-h, --help
Show help for command or subcommand
--version
Display CLI version
DESCRIPTION
The huggingface-cli is the official command-line interface for interacting with the Hugging Face Hub, a platform hosting thousands of machine learning models, datasets, and applications.
It enables users to authenticate, manage repositories, scan and clean local caches, and perform various Hub operations without a graphical interface. Common tasks include logging in with an access token, creating or listing repos, checking user info, and optimizing disk space by deleting cached files.
Designed for developers and researchers, it integrates seamlessly with Python workflows via the huggingface_hub library. Requires Python 3.8+ and installation via pip install -U huggingface_hub. Ideal for CI/CD pipelines, server environments, and local machine maintenance.
CAVEATS
Requires valid HF account and token for private repos. Cache paths depend on HF_HOME env var. Not all Git LFS features supported directly.
INSTALLATION
pip install -U huggingface_hub
Tokens from https://huggingface.co/settings/tokens
EXAMPLE USAGE
huggingface-cli login
huggingface-cli repo create my-model
huggingface-cli scan-cache --verbose
HISTORY
Introduced in huggingface_hub v0.4.0 (2022) as lightweight CLI wrapper. Evolved with Hub features; v0.20+ added repo subcommands and improved cache mgmt.


