chore: update ts docs

pull/372/head
Travis Fischer 2023-02-19 06:29:07 -06:00
rodzic 607fccfc5a
commit 42d163b0b1
7 zmienionych plików z 143 dodań i 69 usunięć

Wyświetl plik

@ -46,7 +46,7 @@ unofficial ChatGPT model.
#### Defined in
[src/chatgpt-api.ts:53](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-api.ts#L53)
[src/chatgpt-api.ts:53](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-api.ts#L53)
## Accessors
@ -60,7 +60,7 @@ unofficial ChatGPT model.
#### Defined in
[src/chatgpt-api.ts:353](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-api.ts#L353)
[src/chatgpt-api.ts:353](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-api.ts#L353)
`set` **apiKey**(`apiKey`): `void`
@ -76,7 +76,7 @@ unofficial ChatGPT model.
#### Defined in
[src/chatgpt-api.ts:357](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-api.ts#L357)
[src/chatgpt-api.ts:357](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-api.ts#L357)
## Methods
@ -111,4 +111,4 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-api.ts:185](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-api.ts#L185)
[src/chatgpt-api.ts:185](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-api.ts#L185)

Wyświetl plik

@ -67,7 +67,7 @@ node_modules/.pnpm/typescript@4.9.5/node_modules/typescript/lib/lib.es2022.error
#### Defined in
[src/types.ts:51](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L51)
[src/types.ts:51](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L51)
___
@ -77,7 +77,7 @@ ___
#### Defined in
[src/types.ts:50](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L50)
[src/types.ts:50](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L50)
___
@ -87,7 +87,7 @@ ___
#### Defined in
[src/types.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L48)
[src/types.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L48)
___
@ -97,7 +97,7 @@ ___
#### Defined in
[src/types.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L49)
[src/types.ts:49](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L49)
___
@ -107,4 +107,4 @@ ___
#### Defined in
[src/types.ts:52](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L52)
[src/types.ts:52](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L52)

Wyświetl plik

@ -36,7 +36,7 @@
#### Defined in
[src/chatgpt-unofficial-proxy-api.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-unofficial-proxy-api.ts#L19)
[src/chatgpt-unofficial-proxy-api.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-unofficial-proxy-api.ts#L19)
## Accessors
@ -50,7 +50,7 @@
#### Defined in
[src/chatgpt-unofficial-proxy-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-unofficial-proxy-api.ts#L65)
[src/chatgpt-unofficial-proxy-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-unofficial-proxy-api.ts#L65)
`set` **accessToken**(`value`): `void`
@ -66,7 +66,7 @@
#### Defined in
[src/chatgpt-unofficial-proxy-api.ts:69](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-unofficial-proxy-api.ts#L69)
[src/chatgpt-unofficial-proxy-api.ts:69](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-unofficial-proxy-api.ts#L69)
## Methods
@ -101,4 +101,4 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-unofficial-proxy-api.ts:96](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/chatgpt-unofficial-proxy-api.ts#L96)
[src/chatgpt-unofficial-proxy-api.ts:96](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/chatgpt-unofficial-proxy-api.ts#L96)

Wyświetl plik

@ -21,7 +21,7 @@
#### Defined in
[src/types.ts:34](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L34)
[src/types.ts:34](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L34)
___
@ -31,7 +31,7 @@ ___
#### Defined in
[src/types.ts:35](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L35)
[src/types.ts:35](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L35)
___
@ -41,7 +41,7 @@ ___
#### Defined in
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L30)
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L30)
___
@ -51,7 +51,7 @@ ___
#### Defined in
[src/types.ts:33](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L33)
[src/types.ts:33](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L33)
___
@ -61,7 +61,7 @@ ___
#### Defined in
[src/types.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L32)
[src/types.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L32)
___
@ -71,4 +71,4 @@ ___
#### Defined in
[src/types.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L31)
[src/types.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L31)

Wyświetl plik

@ -46,7 +46,7 @@
#### Defined in
[src/types.ts:38](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L38)
[src/types.ts:38](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L38)
___
@ -56,7 +56,7 @@ ___
#### Defined in
[src/types.ts:223](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L223)
[src/types.ts:223](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L223)
___
@ -78,7 +78,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in
[src/types.ts:179](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L179)
[src/types.ts:179](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L179)
___
@ -96,7 +96,7 @@ ___
#### Defined in
[src/types.ts:237](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L237)
[src/types.ts:237](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L237)
___
@ -106,7 +106,7 @@ ___
#### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L3)
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L3)
___
@ -157,7 +157,7 @@ ___
#### Defined in
[src/types.ts:263](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L263)
[src/types.ts:263](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L263)
___
@ -183,7 +183,7 @@ Returns a chat message from a store by it's ID (or null if not found).
#### Defined in
[src/types.ts:56](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L56)
[src/types.ts:56](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L56)
___
@ -208,7 +208,7 @@ ___
#### Defined in
[src/types.ts:243](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L243)
[src/types.ts:243](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L243)
___
@ -218,7 +218,7 @@ ___
#### Defined in
[src/types.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L17)
[src/types.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L17)
___
@ -235,7 +235,7 @@ ___
#### Defined in
[src/types.ts:256](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L256)
[src/types.ts:256](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L256)
___
@ -245,7 +245,7 @@ ___
#### Defined in
[src/types.ts:261](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L261)
[src/types.ts:261](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L261)
___
@ -263,7 +263,7 @@ ___
#### Defined in
[src/types.ts:206](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L206)
[src/types.ts:206](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L206)
___
@ -280,7 +280,7 @@ ___
#### Defined in
[src/types.ts:225](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L225)
[src/types.ts:225](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L225)
___
@ -290,7 +290,7 @@ ___
#### Defined in
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L1)
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L1)
___
@ -312,7 +312,7 @@ ___
#### Defined in
[src/types.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L19)
[src/types.ts:19](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L19)
___
@ -336,7 +336,7 @@ ___
#### Defined in
[src/types.ts:5](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L5)
[src/types.ts:5](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L5)
___
@ -362,4 +362,4 @@ Upserts a chat message to a store.
#### Defined in
[src/types.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L59)
[src/types.ts:59](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L59)

Wyświetl plik

@ -39,7 +39,7 @@
#### Defined in
[src/types.ts:62](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L62)
[src/types.ts:62](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L62)
___
@ -60,7 +60,7 @@ ___
#### Defined in
[src/types.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L148)
[src/types.ts:148](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L148)
___
@ -70,7 +70,7 @@ ___
#### Defined in
[src/types.ts:157](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L157)
[src/types.ts:157](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L157)
___
@ -88,7 +88,7 @@ ___
#### Defined in
[src/types.ts:169](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L169)
[src/types.ts:169](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L169)
___
@ -98,4 +98,4 @@ ___
#### Defined in
[src/types.ts:144](https://github.com/transitive-bullshit/chatgpt-api/blob/6cf60ee/src/types.ts#L144)
[src/types.ts:144](https://github.com/transitive-bullshit/chatgpt-api/blob/607fccf/src/types.ts#L144)

Wyświetl plik

@ -1,10 +1,36 @@
chatgpt / [Exports](modules.md)
# ChatGPT API <!-- omit in toc -->
> Node.js client for the unofficial [ChatGPT](https://openai.com/blog/chatgpt/) API.
[![NPM](https://img.shields.io/npm/v/chatgpt.svg)](https://www.npmjs.com/package/chatgpt) [![Build Status](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
- [Intro](#intro)
- [Updates](#updates)
- [CLI](#cli)
- [Install](#install)
- [Usage](#usage)
- [Usage - ChatGPTAPI](#usage---chatgptapi)
- [Usage - ChatGPTUnofficialProxyAPI](#usage---chatgptunofficialproxyapi)
- [Reverse Proxy](#reverse-proxy)
- [Access Token](#access-token)
- [Docs](#docs)
- [Demos](#demos)
- [Projects](#projects)
- [Compatibility](#compatibility)
- [Credits](#credits)
- [License](#license)
## Intro
This package is a Node.js wrapper around [ChatGPT](https://openai.com/blog/chatgpt) by [OpenAI](https://openai.com). TS batteries included. ✨
<p align="center">
<img alt="Example usage" src="/media/demo.gif">
</p>
## Updates <!-- omit in toc -->
## Updates
<details open>
<summary><strong>Feb 19, 2023</strong></summary>
@ -21,7 +47,7 @@ We now provide three ways of accessing the unofficial ChatGPT API, all of which
1. `ChatGPTAPI` - Uses `text-davinci-003` to mimic ChatGPT via the official OpenAI completions API (most robust approach, but it's not free and doesn't use a model fine-tuned for chat)
2. `ChatGPTUnofficialProxyAPI` - Uses an unofficial proxy server to access ChatGPT's backend API in a way that circumvents Cloudflare (uses the real ChatGPT and is pretty lightweight, but relies on a third-party server and is rate-limited)
3. `ChatGPTAPIBrowser` - (v3.5.1 of this package) Uses Puppeteer to access the official ChatGPT webapp (uses the real ChatGPT, but very flaky, heavyweight, and error prone)
3. `ChatGPTAPIBrowser` - (_deprecated_; v3.5.1 of this package) Uses Puppeteer to access the official ChatGPT webapp (uses the real ChatGPT, but very flaky, heavyweight, and error prone)
</details>
@ -69,30 +95,44 @@ Lastly, please consider starring this repo and <a href="https://twitter.com/tran
Thanks && cheers,
[Travis](https://twitter.com/transitive_bs)
# ChatGPT API <!-- omit in toc -->
## CLI
> Node.js client for the unofficial [ChatGPT](https://openai.com/blog/chatgpt/) API.
To run the CLI, you'll need an [OpenAI API key](https://platform.openai.com/overview):
[![NPM](https://img.shields.io/npm/v/chatgpt.svg)](https://www.npmjs.com/package/chatgpt) [![Build Status](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
```bash
export OPENAI_API_KEY="sk-TODO"
npx chatgpt "your prompt here"
```
- [Intro](#intro)
- [Install](#install)
- [Usage (ChatGPTAPI)](#usage-chatgptapi)
- [Usage (ChatGPTUnofficialProxyAPI)](#usage-chatgptunofficialproxyapi)
- [Reverse Proxies](#reverse-proxies)
- [Access Tokens](#access-tokens)
- [Docs](#docs)
- [Demos](#demos)
- [Projects](#projects)
- [Compatibility](#compatibility)
- [Credits](#credits)
- [License](#license)
By default, the response is streamed to stdout, the results are stored in a local config file, and every invocation starts a new conversation. You can use `-c` to continue the previous conversation and `--no-stream` to disable streaming.
## Intro
Under the hood, the CLI uses `ChatGPTAPI` with `text-davinci-003` to mimic ChatGPT.
This package is a Node.js wrapper around [ChatGPT](https://openai.com/blog/chatgpt) by [OpenAI](https://openai.com). TS batteries included. ✨
```
Usage:
$ chatgpt <prompt>
You can use it to start building projects powered by ChatGPT like chatbots, websites, etc...
Commands:
<prompt> Ask ChatGPT a question
rm-cache Clears the local message cache
ls-cache Prints the local message cache path
For more info, run any command with the `--help` flag:
$ chatgpt --help
$ chatgpt rm-cache --help
$ chatgpt ls-cache --help
Options:
-c, --continue Continue last conversation (default: false)
-d, --debug Enables debug logging (default: false)
-s, --stream Streams the response (default: true)
-s, --store Enables the local message cache (default: true)
-t, --timeout Timeout in milliseconds
-k, --apiKey OpenAI API key
-n, --conversationName Unique name for the conversation
-h, --help Display this message
-v, --version Display version number
```
## Install
@ -102,7 +142,22 @@ npm install chatgpt
Make sure you're using `node >= 18` so `fetch` is available (or `node >= 14` if you install a [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill)).
## Usage (ChatGPTAPI)
## Usage
To use this module from Node.js, you need to pick between two methods:
| Method | Free? | Robust? | Quality? |
| --------------------------- | ------ | -------- | ----------------- |
| `ChatGPTAPI` | ❌ No | ✅ Yes | ☑️ Mimics ChatGPT |
| `ChatGPTUnofficialProxyAPI` | ✅ Yes | ☑️ Maybe | ✅ Real ChatGPT |
1. `ChatGPTAPI` - Uses `text-davinci-003` to mimic ChatGPT via the official OpenAI completions API (most robust approach, but it's not free and doesn't use a model fine-tuned for chat). You can override the model, completion params, and prompt to fully customize your bot.
2. `ChatGPTUnofficialProxyAPI` - Uses an unofficial proxy server to access ChatGPT's backend API in a way that circumvents Cloudflare (uses the real ChatGPT and is pretty lightweight, but relies on a third-party server and is rate-limited)
Both approaches have very similar APIs, so it should be simple to swap between them.
### Usage - ChatGPTAPI
Sign up for an [OpenAI API key](https://platform.openai.com/overview) and store it in your environment.
@ -119,6 +174,18 @@ async function example() {
}
```
You can override the default `model` (`text-davinci-003`) and any [OpenAI completion params](https://platform.openai.com/docs/api-reference/completions/create) using `completionParams`:
```ts
const api = new ChatGPTAPI({
apiKey: process.env.OPENAI_API_KEY,
completionParams: {
temperature: 0.5,
top_p: 0.8
}
})
```
If you want to track the conversation, you'll need to pass the `parentMessageid` and `conversationid`:
```ts
@ -180,7 +247,7 @@ You'll notice that we're using a reverse-engineered `promptPrefix` and `promptSu
```ts
const res = await api.sendMessage('what is the answer to the universe?', {
promptPrefix: `You are ChatGPT, a large language model trained by OpenAI. You answer as concisely as possible for each response (e.g. dont be verbose). It is very important that you answer as concisely as possible, so please remember this. If you are generating a list, do not have too many items. Keep the number of items short.
promptPrefix: `You are ChatGPT, a large language model trained by OpenAI. You answer as concisely as possible for each responseIf you are generating a list, do not have too many items.
Current date: ${new Date().toISOString()}\n\n`
})
```
@ -204,7 +271,7 @@ async function example() {
</details>
## Usage (ChatGPTUnofficialProxyAPI)
### Usage - ChatGPTUnofficialProxyAPI
The API is almost exactly the same for the `ChatGPTUnofficialProxyAPI`; you just need to provide a ChatGPT `accessToken` instead of an OpenAI API key.
@ -227,9 +294,9 @@ See [demos/demo-reverse-proxy](./demos/demo-reverse-proxy.ts) for a full example
npx tsx demos/demo-reverse-proxy.ts
```
### Reverse Proxies
#### Reverse Proxy
You can override the reverse proxy by passing `apiReverseProxyUrl` to `ChatGPTUnofficialProxyAPI`:
You can override the reverse proxy by passing `apiReverseProxyUrl`:
```ts
const api = new ChatGPTUnofficialProxyAPI({
@ -245,14 +312,18 @@ Known reverse proxies run by community members include:
| `https://chat.duti.tech/api/conversation` | [@acheong08](https://github.com/acheong08) | 50 req/min | 2/19/2023 |
| `https://gpt.pawan.krd/backend-api/conversation` | [@PawanOsman](https://github.com/PawanOsman) | ? | 2/19/2023 |
### Access Tokens
Note: info on how the reverse proxies work is not being published at this time in order to prevent OpenAI from disabling access.
#### Access Token
To use `ChatGPTUnofficialProxyAPI`, you'll need a ChatGPT access token. You can either:
1. Use [acheong08/OpenAIAuth](https://github.com/acheong08/OpenAIAuth), which is a python script to login and get an access token automatically. This works with email + password accounts (e.g., it does not support accounts where you auth using Microsoft / Google).
1. Use [acheong08/OpenAIAuth](https://github.com/acheong08/OpenAIAuth), which is a python script to login and get an access token automatically. This works with email + password accounts (e.g., it does not support accounts where you auth via Microsoft / Google).
2. You can manually get an `accessToken` by logging in to the ChatGPT webapp and then opening `https://chat.openai.com/api/auth/session`, which will return a JSON object containing your `accessToken` string.
Access tokens last for ~8 hours (TODO: need to verify the exact TTL).
**Note**: using a reverse proxy will expose your access token to a third-party. There shouldn't be any adverse effects possible from this, but please consider the risks before using this method.
## Docs
@ -297,7 +368,9 @@ npx tsx demos/demo-persistence.ts
Any [keyv adaptor](https://github.com/jaredwray/keyv) is supported for persistence, and there are overrides if you'd like to use a different way of storing / retrieving messages.
Note that persisting message is required for remembering the context of previous conversations beyond the scope of the current Node.js process, since by default, we only store messages in memory.
Note that persisting message is required for remembering the context of previous conversations beyond the scope of the current Node.js process, since by default, we only store messages in memory. Here's an [external demo](https://github.com/transitive-bullshit/chatgpt-twitter-bot/blob/main/src/index.ts#L86-L95) of using a completely custom database solution to persist messages.
**Note**: Persistence is handled automatically when using `ChatGPTUnofficialProxyAPI` because it is connecting indirectly to ChatGPT.
## Projects
@ -372,6 +445,7 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
- [openai-chatgpt: Talk to ChatGPT from the terminal](https://github.com/gmpetrov/openai-chatgpt)
- [Clippy the Saleforce chatbot](https://github.com/sebas00/chatgptclippy) ClippyJS joke bot
- [ai-assistant](https://github.com/youking-lib/ai-assistant) Chat assistant
- [Feishu Bot](https://github.com/linjungz/feishu-chatgpt-bot)
If you create a cool integration, feel free to open a PR and add it to the list.