GameMaker (2.3)
Icon

API integration - Chat GPT & DALL-E

Jorge Piñero

You must be logged in to obtain assets

Description

UPDATED V1.2

A very easy-to-use collection of scripts to communicate directly with OpenAI API via HTTP Async. Generate texts and images instantly and in any language to use right on your games!

You can modify all the AI parameters included in the "Playground" and use different language models from Curie to GPT-4 to perform a specific task or have true dialogues. System messages as well as custom conversation senders are allowed. DALL-E 2 images are directly loaded into both a .png file and a sprite for further use. Detailed comments and script descriptions, easy error checking.

  • REGISTER IN OPENAI: https://platform.openai.com/signup (free credits on signup)
  • GET YOUR API KEY: https://platform.openai.com/account/api-keys
  • GET YOUR ORG CODE: https://platform.openai.com/account/org-settings

Tested on Windows and Android platforms, should work in iOS and Mac as well. You don't need to go through OpenAI documentation to use this extension, everything is commented so you know what each parameter does and how to use everything.

FUNCTIONS:

  • openai_setup(): Initializes everything, use your API key and organization code here
  • gpt_chat_add(): Adds a new message to the conversation
  • gpt_chat_send(): Sends http request to GPT
  • gpt_chat_get(): Decodes API answer for chat
  • gpt_chat_delete(): Delete the last message in the conversation
  • dalle_img_send(): Sends http request to DALLE
  • dalle_img_get(): Decodes API answer for image
  • dalle_file_get(): Downloads DALLE image
  • dalle_file_load(): Loads the image into a sprite
  • _chat_list[]: A ds_list containing all conversation
  • _chat_cmap[]: An array packing messages for GPT
  • _token_total: Integer with tokens used so far

INCLUDED: ChatGPT up to 32k & DALL-E 2 up to 1024x1024.

COMING SOON: Whisper Speech-To-Text & Text-to-Speech.

//////////////////////////////////////////

CHANGELOG

  • V1.2: Added a handling failsafe for HTTP timeout.
  • V1.1: Message's list is now a ds_list. Better comments.
  • V1.0: Fully functional GPT and DALLE.

Please leave a review if you like the extension!

End User Licence Agreement (EULA).

Age Rating: 4+

Version

GMS2.3 - Version 1.2.1. Published February 16, 2024

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait