Modern llama.cpp builds can download a model from Hugging Face themselves, so you do not need to fetch the file by hand first. The -hf flag names the repository and the quantization, and llama-server downloads the file and starts serving it.
What you need
- llama.cpp built or installed with llama-server
- The Hugging Face repository and file name for the model
- Enough free disk for the GGUF file
Step 1: Pick the repository and quantization
Find the GGUF repository on Hugging Face and note the exact repository name and file, for example a Q4_K_M file, which is the common default quantization.
Step 2: Start the server with the -hf flag
Run llama-server -hf repository/file.gguf, using the repository and file you noted. The server downloads the file on first use and then starts listening.
Step 3: Confirm the server answers
Open the server address in a browser or run a curl request against its models endpoint, and confirm the model is listed and ready.
Worked example: synthetic Hugging Face download
The table below is a synthetic example. It shows the expected result of downloading with the -hf flag; no download was run.
| Check | Expected | Result |
|---|---|---|
| Repository named | Exact repo and file | Pass |
| Download | Completes | Pass |
| Server starts | Listening | Pass |
| Models endpoint | Model listed | Pass |
Expected result (UNTESTED). the named GGUF file downloads from Hugging Face, the server starts, and the models endpoint lists the model. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- The -hf flag needs the exact repository and file name; a wrong name fails instead of downloading.
- Some repositories are gated and need a licence accepted before the download works.
- The first download needs the internet; later starts reuse the cached file.
