NodeJS library for interacting with OpenAI

Usage no npm install needed!

<script type="module">
  import geePeeTee from '';


gee-pee-tee 🏌️

Deprecated! Use @chatsight/gee-pee-tee instead.

NodeJS library for interacting with OpenAI and their various language models and GPT weights.


/* Stable */
npm install gee-pee-tee

/* Development */
npm install

Quick Start

const openai = require('gee-pee-tee')

const main = async() => {
    const gpt = new openai({apiToken: process.env.OPENAITOKEN})
    await gpt.initialize()
    const req = await gpt.prompt({"prompt":`Hello world is commonly used by programmers as a way of`})
    console.log(require('util').inspect(req,false, null, true))


API Reference


new openai({
  apiToken: STRING,
  engine: STRING, // Default: davinci
  timeout: INT, // Default: 50000
  keepAlive: BOOLEAN, // Internal HTTPS Agent Keepalive
  rejectUnauthorized: BOOLEAN // Internal HTTPS Agent SSL Behaviour


new openai({
  apiToken: "sk-...",
  engine: "davinci",
  timeout: 50000,
  keepAlive: true,
  rejectUnauthorized: true


Initializes the client, required before using any function. Configures the HTTPS agent and applies constructor base presets.

const gpt = new openai({apiToken: ...})

await gpt.initialize()


Method for sending prompts to OpenAI.

  prompt: STRING, // String Literals are supported here and recommended.
  temperature: FLOAT, // Default: 0.3
  maxTokens: INT, // API Name: max_tokens Default: 60
  topProbability: FLOAT, // API Name: top_p Default: 1.0
  frequencyPenalty: FLOAT, // API Name: frequency_penalty Default: 0.5
  presencePenalty: FLOAT, // API Name: presence_penalty Default: 0.0
  stop: ARRAY[...STRING] // Default: "###"
  prompt: `Hello world is commonly used by programmers as a way of`,
  temperature: 0.3,
  maxTokens: 60,
  topProbability: 1.0,
  frequencyPenalty: 0.5,
  presencePenalty: 0.0,
  stop: ["###"]


 id: 'cmpl-...',
 object: 'text_completion',
 model: {
   build: 'davinci:YYYY-MM-DD',
   slug: 'davinci',
   version: 'YYYY-MM-DD'
 choices: {
   elements: 1,
   data: [
       text: 'testing a new program. It is also used as a simple example to introduce a new programming language.\n' +
         '\n' +
         'Hello world is the first program that every programmer writes when learning a new programming language. The phrase was coined by Brian Kernighan in his 1972 book, "A Tutorial Introduction to the Language',
       index: 0,
       logprobs: null,
       finish_reason: 'length'


Returns a detailed manifest of all available engines, and a simple array of engine slugs.



  enginesAvailable: 4
  engineSlugs: [
      id: "engine1",
      object: "engine",
      created: null,
      max_replicas: null,
      owner: "openai",
      permissions: null,
      ready: true,
      ready_replicas: null,
      replicas: null


Switch the engine used by the client. Provides a validation method while doing so.

  verifyChoice: BOOLEAN, // Default: False. If true, fetch a list of available engines and verify the new engine is supported. One shot if false, throws if engine is not supported.
  engine: STRING // Name of the engine by its slug to use.