Skip to content
On this page

Getting Started

Prerequisites

  • Basic knowledge of Node.js.
  • Node.js (at least version 14.x).
  • An OpenAI API key for authentication purposes.
  • Your project must be configured to use ES modules.
commonJS
We plan to add support for commonJS in the near future. 
For now you are forced to use ES modules. 

Installation

Install the package using a package manager of your choice.

npm i easyGPT

OR

yarn add easygpt

Setup

DANGER

easyGPT does not support commonJS (require), you must use ES modules (import/export). 
  • Import "easygpt".
  • Create a new instance of EasyGPT.
  • Set the OpenAI API Key.
js
// Import the installed package from above.
import EasyGPT from "easygpt";

// Create a new instance of EasyGPT.
const gpt = new EasyGPT();

// Set your OpenAI API key.
gpt.setApiKey("<YOUR API KEY HERE>");

Continuing On..

Further documentation will assume that you have done the above steps. i.e.

  • Imported "easygpt".
  • Created a new instance of EasyGPT.
  • Have the API key set.

If any of the further examples do not work, make sure to check you have the above.

An instance of EasyGPT in this documentation will be referred to as <<EasyGPT>>.

js
new EasyGPT(); // = <<EasyGPT>>