Version: 0.5.0
A C library for interacting with OpenAI-compatible, Google Gemini, and Anthropic Claude LLM APIs, with a focus on creating delightful chaos. Supports text and multimodal inputs, file uploads and references, and both regular and streaming responses.
This library is named "Disaster Party" and uses the dp_ prefix for its C symbols. The library file is libdisasterparty.so.
The library is organized into focused modules for maintainability:
disasterparty.h- Public API definitions and declarationsdp_private.h- Private API and internal structures shared across modulesdisasterparty.c- Main library entry points and coordinationdp_context.c- Context management and initializationdp_models.c- Model listing and provider-specific logicdp_message.c- Message construction and managementdp_request.c- HTTP request handling and API callsdp_stream.c- Streaming response processingdp_serialize.c- Conversation serialization/deserializationdp_file.c- File attachment handlingdp_utils.c- Utility functions and helpersdp_constants.c- Constants and default values
This modular design improves code maintainability while preserving the complete public API.
This project uses GNU Autotools.
- Run
./autogen.shto generate the configure script and Makefiles. - Run
./configureto check for dependencies and prepare the build.- You might need to specify a prefix:
./configure --prefix=/usr/local
- You might need to specify a prefix:
- Run
maketo compile the library and tests. - (Optional) Run
make checkto run the test suite. See the "Running Tests" section below for details on required environment variables. - (Optional) Run
sudo make installto install the library and header files.
- libcurl (>= 7.20.0)
- libcjson (>= 1.7.10)
Include disasterparty.h in your C code and link against -ldisasterparty.
Ensure your build system also links against libcurl and libcjson (pkg-config can help with this).
Example compilation:
gcc my_app.c $(pkg-config --cflags --libs disasterparty)See the files in the tests/ directory for usage examples.
For complete testing instructions, environment setup, and test suite information, see TESTING.md.
The Disaster Party library includes comprehensive documentation:
- Manual Pages: Individual manual pages for each function are available in the
man/directory. These provide detailed API documentation with examples and usage information. - Complete Documentation: A consolidated markdown version of all manual pages is available in docs/DOCUMENTATION.md, designed for easy reading and AI consumption.
To view manual pages (after installation):
man disasterparty # Library overview
man dp_init_context # Context initialization
man dp_perform_completion # Basic completion requests
# ... and many moreThe documentation covers all public API functions, data structures, usage examples, and provider-specific considerations.