llama.cpp
by ggml-org
Fast LLM inference in plain C/C++, from laptops to servers.
- Stars
- 136,180 stars
- Forks
- 26k forks
- Last push
- today
- Activity
- Active
# Install (macOS or Linux)$ curl -LsSf https://llama.app/install.sh | sh# Chat with a model from Hugging Face$ llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF# Start an OpenAI-compatible server$ llama serve -hf ggml-org/Qwen3.5-0.8B-GGUFCommands from the project's README. Run them after installing (see below).
Overview
Understand llama.cpp in 60 seconds
- What it does
- llama.cpp runs large language models efficiently in C and C++ on a wide range of hardware, from laptops to cloud servers. It can download a model from Hugging Face and chat with it, or serve it through an OpenAI-compatible API with a built-in chat app.
- The problem it solves
- Running language models usually needs heavy Python stacks and big GPUs. llama.cpp aims for minimal setup and state-of-the-art performance on many kinds of hardware, and it powers many other local AI tools.
- Why choose it
- Choose it for lightweight, fast local inference with GGUF models and an OpenAI-compatible server. For a more beginner-friendly wrapper, Ollama builds on it.
- Who should use it
- Developers running models locally with minimal setup
- People with modest hardware who want local AI
- Engineers embedding LLM inference in apps
- Tool builders who need a fast inference engine
- Setup difficultyAdvanced
You'll need:
- macOS, Linux or Windows
- Enough RAM or VRAM for the model
How llama.cpp works
llama.cpp is built on the ggml tensor library. Its goal is LLM and multimodal model inference with minimal setup and state-of-the-art performance, locally and in the cloud.
After installing, llama cli -hf downloads a GGUF model from Hugging Face and opens a chat session, including vision models. llama serve starts an OpenAI-compatible API server, and Llama Chat, a built-in chat app, can run against it.
You can install with a one-line script, use Docker, download pre-built binaries from the releases page or build from source. Documentation covers multi-GPU use, Android builds, text-to-speech models, grammars and performance tips. It is MIT licensed.
Features
Key features
Fast C/C++ inference
Minimal setup across many hardware types.
Hugging Face downloads
Run GGUF models directly with -hf.
OpenAI-compatible server
llama serve exposes an API.
Built-in chat app
Llama Chat runs against the server.
Multimodal
Vision and text-to-speech models.
Many install options
Script, Docker, binaries or source.
Strengths
- Runs on a huge range of hardware
- Very active, widely used project
- Powers many other local AI tools
- MIT licensed
Limitations
- Uses GGUF model files
- More technical than desktop apps
- Performance tuning can need the docs
Practical use cases
Local chat
Chat with a small model on a laptop.
Local API backend
Serve a model to apps via the OpenAI API.
Embedded inference
Build inference into C/C++ apps.
Installation
Install llama.cpp
Commands come from llama.cpp's README. AIRepoHub hasn't run them yet. View source
Prerequisites
- A computer with enough memory for the model
Supported systems
- macOS
- Linux
- Windows
- 1
Install
Shellcurl -LsSf https://llama.app/install.sh | sh
- 1
Install
Shellcurl -LsSf https://llama.app/install.sh | sh
- 1
Install in PowerShell
PowerShellirm https://llama.app/install.ps1 | iex
- 1
Download a release
Get pre-built binaries from the releases page, or build from source with docs/build.md.
Configuration and API keys
| Setting | What it's for |
|---|
First run
- 1
Chat with a small model
Shellllama cli -hf ggml-org/Qwen3.5-0.8B-GGUF
llama.cpp's documentation doesn't include sample output, so we don't show any. Expect the results in your terminal.
Your first project
Serve a local model with an OpenAI-compatible API
Download a small model from Hugging Face and serve it to your apps.
Before you start
- llama.cpp installed
- 1
Try the model in the terminal
Shellllama cli -hf ggml-org/Qwen3.5-0.8B-GGUF - 2
Start the server
Shellllama serve -hf ggml-org/Qwen3.5-0.8B-GGUF - 3
Chat in the browser
Use Llama Chat, the built-in chat app, against the running server.
What to expect
The model downloads from Hugging Face, answers in the terminal, and the server exposes an OpenAI-compatible API.
Next steps
- Read the server README in tools/server
- See the multi-GPU guide
- Check the performance troubleshooting tips
Costs and requirements
What it costs to run
- License
- MIT.Free
- Software
- Free and open source.Free
Troubleshooting
Common setup issues
Slow token generation
See the performance troubleshooting guide in the docs.
Need GPU or platform-specific builds
Follow the build guide in docs/build.md.
Prefer containers
See the Docker documentation in docs/docker.md.
Alternatives
Similar AI repositories
ollama
ollama
Run open models like Gemma, Qwen and DeepSeek on your own machine with a single command.
open-webui
open-webui
Self-hosted chat interface for Ollama and OpenAI-compatible models.
NextChat
ChatGPTNextWeb
Chat app for talking to many AI models like GPT, Claude and Gemini on web, desktop and mobile.
LlamaFactory
hiyouga
Toolkit for fine-tuning many open language and vision-language models with one unified interface.