Install
CAIL is a static C++23 library for calling LLM providers from your application.
You install it once with CMake, link cail::cail in your project, and include the
headers you need. Include <cail/cail.hpp> for the full API, or narrower headers
such as <cail/generate.hpp> and <cail/openai.hpp> for a single provider.
CAIL is in alpha. Interfaces can change between releases. Pin the version you depend on and skim the docs when you upgrade.
Prerequisites
Section titled “Prerequisites”- CMake 3.31 or newer
- A C++23 compiler supported by the pinned Glaze release
- OpenSSL development files for HTTPS
Install as a CMake package
Section titled “Install as a CMake package”From a CAIL source tree, install the library and its dependencies to a prefix:
cmake -S . -B build -DCAIL_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFFcmake --build buildcmake --install build --prefix /path/to/cailIn your application’s CMakeLists.txt:
find_package(cail 0.3 CONFIG REQUIRED)target_link_libraries(app PRIVATE cail::cail)Configure your app with -DCMAKE_PREFIX_PATH=/path/to/cail so CMake finds the
installed package. Build CAIL with the same compiler and compatible build
settings as your application.
The install step also places Glaze and magic_enum in the same prefix, so you do not need separate dependency installs for a normal consumer build.
Dependencies at configure time
Section titled “Dependencies at configure time”CAIL uses Glaze 8.4.0 or newer and
magic_enum. The first cmake configure
in the CAIL tree downloads them unless they are already on your system.
For offline or locked-down builds, install those libraries yourself and point CMake at them:
cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/depsTry the examples (optional)
Section titled “Try the examples (optional)”If you cloned the repository and want runnable samples before wiring CAIL into your own target:
cmake -S . -B buildcmake --build build --target cail_openai_promptexport OPENAI_API_KEY="your-key"./build/cail_openai_promptSet the API key for whichever provider example you run. The Providers guide lists environment variable names.
Contributing to CAIL
Section titled “Contributing to CAIL”If you are changing the library itself, see Build and test
for the ./dev workflow, test suites, and CI checks. Compile time
covers header include costs when you add CAIL to a large codebase.
Next steps
Section titled “Next steps”- Quickstart for your first generation request
- Providers to pick and configure a provider