0.6.1 • Published 2 years ago

chatgpt-api-pool v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ChatGPT API Pool

Build your own ChatGPT with a request pool.

NOTICE: due to chatgpt dependency does not support CJS, so this library does not work properly in CJS environment, use it on your own risk, recommend to use ESM.

Use gpt-3.5-turbo

Usage

const API_KEYS = ['...', '...']
const EMAIL_CONFIG = {
  // Here is a documentation about QQ email:https://www.ujcms.com/documentation/351.html
  serverConfig: {
    host: 'smtp.xx.com',
    port: 465,
    secure: true,
    auth: {
      user: 'xxx',
      pass: 'xxx'
    }
  },
  targetEmail: 'xxx@qq.com'
}
// EMAIL_CONFIG is optional, to provide email notification when key is exhausted
const requestPool = new RequestPool(API_KEYS, EMAIL_CONFIG)
const response: {
  success: boolean
  message: ChatMessage /* from chatgpt library */
  error: ErrorType
} = await requestPool.sendMessage(q, options) // options, see https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/types.ts#L5-L15

ErrorType

enum ErrorType {
  NO_VALID_KEYS = 'no_valid_keys',
}
0.6.1

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago