liboai
is a simple, unofficial C++17 library for the OpenAI API. It allows developers to access OpenAI endpoints through a simple collection of methods and classes. The library can most effectively be thought of as a spiritual port of OpenAI's Python library, simply called openai
, due to its similar structure - with few exceptions.
liboai
and its Python alternative are when generating an image using DALL-E.
Running the above will print out the URL to the resulting generated image, which may or may not look similar to the one found below.
Example Image |
![]() |
---|
Keep in mind the above C++ example is a minimal example and is not an exception-safe snippet. Please see the documentation for more detailed and exception-safe code snippets.
For the library to work the way it does, it relies on two major dependencies. These dependencies can be found listed below.
- nlohmann-json - cURL *If building the library using the provided solution, it is recommended to install these dependencies using vcpkg.*
For detailed documentation and additional code examples, see the library's documentation here.
Artificial intelligence is an exciting and quickly-changing field. If you'd like to partake in further placing the power of AI in the hands of everyday people, please consider contributing by submitting new code and features via a **Pull Request**. If you have any issues using the library, or just want to suggest new features, feel free to contact me directly using the info on my profile or open an **Issue**. Please note that all Pull Requests should target the [dev](https://github.com/D7EAD/liboai/tree/dev) branch where additions will be tested and pushed to `main` once finalized.