{"id":13645758,"url":"https://github.com/d7ead/liboai","last_synced_at":"2025-04-21T17:31:18.820Z","repository":{"id":65440906,"uuid":"581625434","full_name":"D7EAD/liboai","owner":"D7EAD","description":"A C++17 library to access the entire OpenAI API.  ","archived":false,"fork":false,"pushed_at":"2025-02-09T00:29:49.000Z","size":942,"stargazers_count":410,"open_issues_count":5,"forks_count":77,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-18T21:01:38.351Z","etag":null,"topics":["ai","api","artificial-intelligence","chatgpt","chatgpt-api","chatgpt3","dall-e","generator","gpt","interface","library","machine-learning","ml","neural-network","openai","openai-api"],"latest_commit_sha":null,"homepage":"https://openai.com/api/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/D7EAD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-23T18:54:25.000Z","updated_at":"2025-04-17T03:29:17.000Z","dependencies_parsed_at":"2023-11-21T00:31:52.599Z","dependency_job_id":"6055d00f-d15b-4556-a47b-9958a7049c0d","html_url":"https://github.com/D7EAD/liboai","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D7EAD%2Fliboai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D7EAD%2Fliboai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D7EAD%2Fliboai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/D7EAD%2Fliboai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/D7EAD","download_url":"https://codeload.github.com/D7EAD/liboai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250100370,"owners_count":21374928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","artificial-intelligence","chatgpt","chatgpt-api","chatgpt3","dall-e","generator","gpt","interface","library","machine-learning","ml","neural-network","openai","openai-api"],"created_at":"2024-08-02T01:02:41.229Z","updated_at":"2025-04-21T17:31:18.814Z","avatar_url":"https://github.com/D7EAD.png","language":"C++","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/images/_logo.png\"\u003e\n\u003c/p\u003e\n\n\u003chr\u003e\n\u003ch1\u003eIntroduction\u003c/h1\u003e\n\u003cp\u003e\u003ccode\u003eliboai\u003c/code\u003e is a simple, \u003cb\u003eunofficial\u003c/b\u003e 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 \u003cb\u003espiritual port\u003c/b\u003e of OpenAI's Python library, simply called \u003ccode\u003eopenai\u003c/code\u003e, due to its similar structure - with few exceptions.\n\n\u003ch3\u003eFeatures\u003c/h3\u003e\n\n- [x] [ChatGPT](https://github.com/D7EAD/liboai/tree/main/documentation/chat)\n- [X] [Audio](https://github.com/D7EAD/liboai/tree/main/documentation/audio)\n- [X] [Azure](https://github.com/D7EAD/liboai/tree/main/documentation/azure)\n- [X] [Functions](https://platform.openai.com/docs/api-reference/chat/create)\n- [x] [Image DALL·E](https://github.com/D7EAD/liboai/tree/main/documentation/images)\n- [x] [Models](https://github.com/D7EAD/liboai/tree/main/documentation/models)\n- [x] [Completions](https://github.com/D7EAD/liboai/tree/main/documentation/completions) \n- [x] [Edit](https://github.com/D7EAD/liboai/tree/main/documentation/edits) \n- [x] [Embeddings](https://github.com/D7EAD/liboai/tree/main/documentation/embeddings) \n- [x] [Files](https://github.com/D7EAD/liboai/tree/main/documentation/files) \n- [x] [Fine-tunes](https://github.com/D7EAD/liboai/tree/main/documentation/fine-tunes) \n- [x] [Moderation](https://github.com/D7EAD/liboai/tree/main/documentation/moderations)\n- [X] Asynchronous Support\n\n\u003ch1\u003eUsage\u003c/h1\u003e\nSee below for just how similar in style \u003ccode\u003eliboai\u003c/code\u003e and its Python alternative are when generating an image using DALL-E.\u003c/p\u003e\n\u003cdetails open\u003e\n\u003csummary\u003eDALL-E Generation in Python.\u003c/summary\u003e\n\u003cbr\u003e\n\n```py\nimport openai\nimport os\n\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nresponse = openai.Image.create(\n    prompt=\"A snake in the grass!\",\n    n=1,\n    size=\"256x256\"\n)\nprint(response[\"data\"][0][\"url\"])\n```\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003eDALL-E Generation in C++.\u003c/summary\u003e\n\u003cbr\u003e\n\n```cpp\n#include \"liboai.h\"\n\nusing namespace liboai;\n\nint main() {\n  OpenAI oai;\n  oai.auth.SetKeyEnv(\"OPENAI_API_KEY\");\n\t\n  Response res = oai.Image-\u003ecreate(\n    \"A snake in the grass!\",\n    1,\n    \"256x256\"\n  );\n\n  std::cout \u003c\u003c res[\"data\"][0][\"url\"] \u003c\u003c std::endl;\n}\n```\n\n\u003c/details\u003e\n\n\u003cp\u003eRunning the above will print out the URL to the resulting generated image, which may or may not look similar to the one found below.\u003c/p\u003e\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003eExample Image\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctd\u003e\n\n\u003cimg src=\"/images/snake.png\"\u003e\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cp\u003e\u003ci\u003eKeep in mind the above C++ example is a minimal example and is not an exception-safe snippet. Please see \u003ca href=\"/documentation\"\u003ethe documentation\u003c/a\u003e for more detailed and exception-safe code snippets.\u003c/i\u003e\u003c/p\u003e\n\n\u003ch1\u003eDependencies\u003c/h1\u003e\n\u003cp\u003eFor the library to work the way it does, it relies on two major dependencies. These dependencies can be found listed below.\u003cp\u003e\n\n- \u003ca href=\"https://github.com/nlohmann/json\"\u003enlohmann-json\u003c/a\u003e\n- \u003ca href=\"https://curl.se/\"\u003ecURL\u003c/a\u003e\n\n*If building the library using the provided solution, it is recommended to install these dependencies using \u003cb\u003evcpkg\u003c/b\u003e.*\n\n\u003ch1\u003eDocumentation\u003c/h1\u003e\n\u003cp\u003eFor detailed documentation and additional code examples, see the library's documentation \u003ca href=\"/documentation\"\u003ehere\u003c/a\u003e.\n\n\u003ch1\u003eContributing\u003c/h1\u003e\n\u003cp\u003eArtificial intelligence is an exciting and quickly-changing field. \n\nIf 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 \u003ca href=\"https://github.com/D7EAD\"\u003eprofile\u003c/a\u003e or open an **Issue**.\n","funding_links":[],"categories":["Openai"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7ead%2Fliboai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd7ead%2Fliboai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd7ead%2Fliboai/lists"}