[v1.1] OpenAI API System

OpenAI API System

Greetings! As Robots start to expand, and coming out with more creative and innovative ways to work, I’ve decided to make a nifty module simply for the API.


  • Modulized
  • Easy Setup
  • Rate Limitation
  • Anti API Exhaustion
  • Conversation Message History!

To Be Added

  • Any cool ideas you want added?

I want to use it!

You can find the download below
OpenAIv1.1.rbxm (2.9 KB)

  1. Place the file into ServerScriptService
  2. Obtain a Api Key from Open AI
  3. On the modulescript, edit the ApiKey as shown
  4. Success!

:createChatCompletion(message, temperature, topP)

message - The message you want to send, with a configurable array to have your AI do exactly what you please! (found in the module, line 40 roleTbl)
temperature - Effectively tune how random responses are, default 0
topP - Effectively tune responses, alter temperature or top_p not both

:conversate(player, message)

player - Instance of the player
message - Message to send to the AI

Example Usage

-- Require the correct path
local OpenAIChat = require(script.Parent["OpenAIChat v1.1"]);
local chat = OpenAIChat.new()

-- Asking what's 2+2?
warn(chat:createChatCompletion("What is 2+2?"))

-- Having a conversation with the AI
		warn(chat:conversate(plr, msg));

Support Server

Have any questions or inquiries? Feel free to join the Development Support Server


1 Like

You would need to show line seven of ServerScriptService.OpenAI.Script for further debugging.

I think you called it as a function rather as a method

OpenAIChat.conversate(player, message) -- incorrect (whats going on in your script)
OpenAIChat.conversate(self, player, message) -- correct (what it should be)
-- or
OpenAIChat:conversate(player, message) -- syntatic sugar (the correct way)

I didn’t call any functions. I imported the system with no changes.

1 Like

I checked the server script in the file provided and it looks like that they forgot to replace the . with :
you could easily fix this by replacing the . with :


Hey there!

Thanks for keeping them occupied as I was occupied.
Just wrapped up an update for DTR, will now be prioritizing this System today.


Can you show line seven of ServerScriptService.OpenAI.Script?

You could have just looked for it yourself…

You would need to call OpenAIChat.new() and assign that to a variable prior to using any of the methods.

I’m sorry but isn’t this the same 6th resource that uses openai api? I’ve seen too many of them laterly and they’re all the same.

1 Like

I’d like to answer this properly.

Of course there’s millions of resources for it, however my goal is to be better than others. Not to mention I released this same day GPT-3.5 was available to the public.

Now if you’re seeing the resources and seeing almost the same function names, it’s because we’re utilizing the documentation. There’s no problem with users contributing an asset as long as they enjoy it and optionally is better than others.


Sounds cool, I could use conversate in a textlabel maybe to create a chatting ai.

You are correct.

Currently working on a remake of the site colors/buttons/UI as a plugin with optional features, these include but are not limited to:

  • Conversation History
  • Close/Reopen Chats + History (:GetSetting)
  • Custom Prompts to load into a chat
  • More to be discussed.
1 Like

Currently in the process of being rewritten/updated.
You can receive an optional notification when I update the system here :smile:

Updated to v1.1

  • Removed createCompletion for older models, bringing more support for newer models

  • Reworked the API, it was originally rushed it should now be a lot more efficient and less clueless with the responses

  • Will be wrapped in a plugin once ready

When I set the model to be ‘gpt-4’, I receive a ‘Error sending request to OpenAI API: HTTP 404 (Not Found)’ error, how can I solve this?