OpenAI FiveM Wrapper allows you to interact with the OpenAI API
- Download the resource from the release section
- Get your OpenAI API Key from here
- Add a convar in your server.cfg as follow:
set openai_api_key yourApiKey
- Add
ensure openai_fivem
to your server.cfg - Restart your server
- You're done ! You can start using the OpenAI FiveM Wrapper
Create chat completion using OpenAI GPT models
doChatCompletion(message, [optionnal] systemOrder, [optionnal] model)
local number <const> = exports.openai_fivem:doChatCompletion("Give me a number between 1 and 5")
local answer <const> = exports.openai_fivem:doChatCompletion("Give me my money!!", "You are a police officer NPC in a video game", "gpt-4")
For the moment, OpenAI handles each request individually, so you cannot make several requests at once. Use the isBusy
export to knows if you can make a request.