Skip to main content
AIDiveForge AIDiveForge

llama.cpp

FreeOpen SourceAPISelf-Hosted

The open-source engine that many local AI apps are built on. Use it directly as a command-line tool or as an OpenAI-compatible server.

Similar tools

Get This Tool

License: MIT Any use incl. commercial
Local-run terms: MIT license permits unrestricted use, modification, and distribution for any purpose including commercial applications, provided original license and copyright notice are retained.

Screenshots 4

Pricing

Model
Free

Summary

llama.cpp is the MIT-licensed C/C++ engine that runs GGUF models on your own hardware. We ran the official llama.cpp:server Docker image (build 11681) on a CPU-only server with a 3B model (qwen2.5:3b). It had the smallest footprint of the runtimes we tested: a 1.21 GB image, about 1.6 GB of memory with the model loaded, and not a single DNS lookup during the test. Its server speaks the OpenAI chat API, so existing OpenAI code can use it by changing the base URL. Back to back on the same model file and cores, Ollama generated text 5 to 17% faster, though the VM was busier during the llama.cpp run. Like Ollama, it started 8 threads in a 3-core container by default, which made generation 7.6 times slower until we passed --threads 3. The trade-off is that it's an engine, not a model manager: you find and download GGUF files yourself.

Bottom line: Pick it when you want the engine itself, with full control over every setting and nothing phoning home. Pick an app like Ollama if you'd rather have model downloads and setup handled for you.

We installed and ran it

Tested October 16, 2026 by ForgeBench, our automated test bench · version build 11681 (commit 5e03a1ff4) · MIT license

How we installed it
Official Docker image (llama.cpp:server), one command
Docker image size on disk
1.21 GB
Model we used
qwen2.5:3b (Q4_K_M GGUF, 1.9 GB)
Server start to first answer, model file not cached
8.7 s
Memory used by the model process
1.6 GB
  • Like Ollama, the llama.cpp server started 8 threads inside a 3-core container by default; text generation was 7.6x slower than with --threads 3.
  • The first cold start after pulling the image took 74 s; the two after it took 9 s and 4 s. We show the median.
  • It made no DNS lookups during the test (we log every lookup).

Measured against Ollama

Tested October 16, 2026 by ForgeBench, our automated test bench, on the same machine, back to back.

Measuredllama.cppOllama
Server start to first answer, model file not cached (s)8.77.9
Text generation speed, 53-token prompt, relative1x1.07x
Text generation speed, 441-token prompt, relative1x1.05x
Text generation speed, 723-token prompt, relative1x1.17x
Prompt reading speed, 53-token prompt, relative1x1.06x
Prompt reading speed, 441-token prompt, relative1x1.11x
Prompt reading speed, 723-token prompt, relative1x1.07x
Memory used by the model process (GB)1.62.2
Docker image size on disk (GB)1.219.37

Same GGUF model file, same 3 cores, measured back to back in one session. The VM's CPU steal was higher during the llama.cpp run (13.6% vs 7.2%), so differences under about 10% are within noise.

llama.cpp vs Ollama →

Measured against LocalAI

Tested October 16, 2026 by ForgeBench, our automated test bench, on the same machine, back to back.

Measuredllama.cppLocalAI
Server start to first answer, model file not cached (s)3.56.4
Text generation speed, 53-token prompt, relative0.98x1x
Text generation speed, 441-token prompt, relative0.96x1x
Text generation speed, 723-token prompt, relative0.99x1x
Prompt reading speed, 53-token prompt, relative1.22x1x
Prompt reading speed, 441-token prompt, relative0.99x1x
Prompt reading speed, 723-token prompt, relative0.94x1x
Memory used by the model process (GB)1.61.7
Docker image size on disk (GB; LocalAI's backend is a separate download)1.211.2

Same GGUF model file, same 3 cores, same 4,096-token context, measured back to back in one session; LocalAI runs the model through its own llama-cpp backend. CPU steal: 12.8% during the llama.cpp run, 11.5% during LocalAI's, so differences under about 10% are within noise. LocalAI's image size does not include that backend, a separate 165 MB download. The llama.cpp numbers here come from a second llama.cpp run that day, not the one in the Ollama comparison.

llama.cpp vs LocalAI →

Test machine: 8-vCPU AMD EPYC 9354P cloud VM, each test limited to 3 cores and 10 GB RAM, no GPU, no internet (isolated Docker network). Times in seconds are from this CPU-only machine; a desktop with a GPU will be much faster. The VM is shared, so text-generation speed is shown only as a ratio between tools run back to back, not as tokens per second. Docker image size is the on-disk size from docker image ls for every tool. Local AI tools we tested · How we test · raw data

Find your fit

Before you choose llama.cpp

More options in Local Inference Runtimes. Compare pricing, platforms, and features side by side.

Browse Local Inference Runtimes

Pros

  • OpenAI-compatible server, so code written for the OpenAI chat API can use a local model by changing the base URL.
  • Its server handles several users at once with continuous batching, on by default.
  • Small footprint in our test: about 1.6 GB of memory for a 3B model, and no DNS lookups.

Cons

  • It is an engine, not a model manager: you pick and download GGUF files yourself, where apps like Ollama do that for you.
  • In containers it does not size threads to the CPU limit; with 3 cores, generation was 7.6 times slower until we passed --threads 3.
  • Answer quality is limited by the open-weight model you can run on your hardware.

About

Platforms
Linux, macOS, Windows, Android, ChromeOS, iOS, Web (WebGPU)
API Available
Yes
Self-Hosted
Yes
Last Updated
June 9, 2026

Best For

Who it's for

  • Developers who want direct control over how a local model runs
  • Self-hosted servers that need an OpenAI-compatible API

What it does well

  • Serve a local model behind an OpenAI-compatible API
  • Run GGUF models on CPU-only machines
  • Tune threads, context and memory settings yourself

Integrations

OpenAI-compatible APIHugging Face model integrationGBNF grammarsmultimodal support (vision)function calling

Frequently Asked Questions

Is llama.cpp free?
llama.cpp offers a free option. Hosting, model usage, or optional services may have separate costs; check the pricing details and official terms.
Is llama.cpp open source?
Yes. llama.cpp is open source — the source repository is at https://github.com/ggml-org/llama.cpp.
Does llama.cpp have an API?
Yes. llama.cpp exposes a developer API. See the official documentation at https://llama.app for details.
Can I self-host llama.cpp?
Yes. llama.cpp supports self-hosting on your own infrastructure.
When was llama.cpp released?
llama.cpp was first released in 2023.
What platforms does llama.cpp support?
llama.cpp is available on: Linux, macOS, Windows, Android, ChromeOS, iOS, Web (WebGPU).

llama.cpp is the open-source C/C++ engine that runs language models in the GGUF format on your own hardware. It is MIT-licensed and developed at github.com/ggml-org/llama.cpp. Other local AI tools build on it; LocalAI, for example, runs models through its llama-cpp backend.

You can use it three ways: build or download the binaries, run the official Docker server image, or install the Llama app and CLI from llama.app, which its page says comes from the llama.cpp team and Hugging Face. The server speaks the OpenAI chat API, so code written for that API can point at it. Its server documentation lists continuous batching and parallel decoding for several users at once, both on by default.

We ran the official llama.cpp:server Docker image on a CPU-only server with a 3B model (qwen2.5:3b, the same file we used for Ollama and LocalAI). The model used about 1.6 GB of memory, and the server made no DNS lookups during the test. Our measured results, including back-to-back comparisons with Ollama and LocalAI, are in the test section on this page.

One setting matters in containers: by default it started 8 threads inside a 3-core container, and text generation was 7.6 times slower than with –threads 3. If you limit CPUs, set the thread count to match.

Share This Tool

Compare This Tool
Contribute