ggml-org/llama.cpp
API
The public C API of libllama is declared in two headers:
include/llama.h— the canonical, stable header (~80 KB). Every public symbol that downstream consumers can rely on is here.include/llama-cpp.h— small C++-only convenience header with smart-pointer typedefs (llama_model_ptr,llama_context_ptr, ...).
libggml exposes its own public surface under ggml/include/.
What's covered here
- Public symbols — guided tour of the major API groups in
llama.h.
For the implementation side, see Library entry point and the rest of Systems. For the HTTP API exposed by llama-server, see llama-server tool and tools/server/README.md.
ABI stability
llama.cpp does not version its API with semver. Breaking changes to llama.h are tracked in issue 9289. Server REST API changes are tracked in issue 9291. New symbols are added regularly; deprecations carry comments in the header for one or two releases before removal.
Linking
For C/C++ projects using CMake:
find_package(llama REQUIRED)
target_link_libraries(myapp PRIVATE llama)The package config is cmake/llama-config.cmake.in. A minimal example consumer is examples/simple-cmake-pkg/.
For C-only users:
#include <llama.h>For C++:
#include "llama.h"
#include "llama-cpp.h" // optional, for smart pointersHeader conventions
- All public symbols are prefixed with
llama_and usesnake_case. - Public types are
struct llama_<thing>orenum llama_<thing>. - Init/free pairs follow the
<class>_init/<class>_freeconvention. - Sized integer types (
int32_t,int64_t,uint8_t,size_t) are used everywhere — see Patterns and conventions. - Functions return either an
int32_tstatus, a typed enum, or a pointer; they never throw across the C boundary.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.
Previous
gguf-py
Next
Public symbols