Initialize the library

But first.. what even is OpenLib?

OpenLib is a library that lets you use the chatgpt api for free (almost) With this library you can do Text Completion and Chat Completion, it is open source and can be found in this github repository, please leave a star if you like this project And keep in mind, this is for roblox executors not roblox games however i might port it to work as a server script that you can add, if we get 5 stars on the github repo i will do it.

Get an api key.

Sadly we need an api key for this too but thankfully its free, however there is a credit system but lets ignore that for now.

You can get an api key from this server, to get it you have to go to the "Bot" channel and use the /key slash command and the bot should give you your api key.

Initializing the library

Alright now lets initialize the library, to do this we will add this piece of code:

local OpenLib = loadstring(game:HttpGet('https://raw.githubusercontent.com/altacountbabi/OpenLib/main/src.lua'))()

local client = OpenLib.init({
    api_key = 'pk-Nx*********************************************id'
})
All Arguments/Options

api_key (string) (required)

api_base (string) (optional) (default: "https://api.pawan.krd/v1") changes the api endpoint so you can actually just use the official openai api if you want to

reset_ip (bool) (optional) (default: true) this only works when the api_base is "https://api.pawan.krd/v1" or default i recommend that you leave this on as it will attempt to link your api key to the user's ip

Alright, now we have the client loaded we can use text completion or chat completion

Last updated