Hugging Face hf CLI

Hugging Face hf CLI: the CLI for the Hugging Face Hub — manage models, datasets and Spaces from the terminal.

Working when we checked on .

Visit Hugging Face hf CLI

What is Hugging Face hf CLI?

The Hugging Face hf CLI is a command-line interface bundled with the huggingface_hub Python package that lets users interact with the Hugging Face Hub directly from a terminal. It targets developers and ML practitioners who need to manage models, datasets, Spaces, and other Hub resources programmatically. Users can log in to an account, create repositories, upload and download files, manage local cache, run Jobs, sync files to buckets, and manage Inference Endpoints. It supports multiple output formats (human, agent, JSON, quiet) and offers an installable skill so AI coding agents can use it.

Hugging Face hf CLI pricing

Pricing model: Free

Free and open source

Hugging Face hf CLI pros

  • Installable via standalone script, pip, uvx, or Homebrew on macOS, Linux, and Windows
  • Manages models, datasets, Spaces, collections, papers, buckets, and Inference Endpoints
  • Flexible output formats: human tables, agent TSV, JSON, and quiet IDs for scripting
  • hf update detects install method and upgrades automatically
  • Includes an hf-cli skill for AI agents like Claude Code, Codex, and Cursor
  • Shell completion can be installed with --install-completion

Hugging Face hf CLI cons

  • A Hugging Face account login is required for private repos, uploads, and PRs
  • The guide covers only main features; full command reference is in separate documentation
  • Update-check warning prints to stderr unless disabled with HF_HUB_DISABLE_UPDATE_CHECK=1

Frequently asked questions about Hugging Face hf CLI

What is the hf CLI used for?

It allows interacting with the Hugging Face Hub directly from a terminal: logging in, creating repositories, uploading and downloading files, configuring the machine, and managing cache.

How can the hf CLI be installed?

It can be installed via a standalone installer script, pip (as part of huggingface_hub), uvx for isolated ephemeral runs, or Homebrew with 'brew install hf'.

How do I log in to my Hugging Face account?

Run 'hf auth login' in the terminal. Login is required for actions such as downloading private repos, uploading files, and creating PRs.

What output formats does the CLI support?

Commands accept --format with values auto, human, agent, json, or quiet. The --json and -q flags are shortcuts for JSON output and IDs-only output respectively.

How do I update the CLI to the latest version?

Run 'hf update'. It detects how hf was installed (Homebrew, standalone installer, or pip) and runs the matching update command, also refreshing the agent skill if installed.

Can AI coding agents use the hf CLI?

Yes. An hf-cli skill can be installed for Claude Code, Codex, Cursor, OpenCode, and other agents that load skills from .agents/skills. The standalone installer adds it by default.

Who is the hf CLI intended for?

It is designed for developers and users of the Hugging Face Hub who want to manage models, datasets, Spaces, and related resources from the command line or scripts.

Which platforms can the standalone installer run on?

The standalone installer works on macOS, Linux (curl-based shell script), and Windows (PowerShell-based installer).

How can I avoid truncated values in table output?

Pass --no-truncate to show full values in human tables, or use --format json for structured output of list and dict columns.

How do I get details about a specific command?

Use the --help option on any command, for example 'hf upload --help', to list all available options and their details.

Categories

Use cases

Alternatives to Hugging Face hf CLI

Similar AI tools

Search AI tools on NeedAnAI · All AI tools A–Z