diff --git a/legacy/docs/classes/ChatGPTAPI.md b/legacy/docs/classes/ChatGPTAPI.md
index 76eb5f5a..a0e1e2d6 100644
--- a/legacy/docs/classes/ChatGPTAPI.md
+++ b/legacy/docs/classes/ChatGPTAPI.md
@@ -36,7 +36,7 @@ Creates a new client wrapper around the unofficial ChatGPT REST API.
#### Defined in
-[chatgpt-api.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L31)
+[chatgpt-api.ts:31](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L31)
## Methods
@@ -50,7 +50,7 @@ Creates a new client wrapper around the unofficial ChatGPT REST API.
#### Defined in
-[chatgpt-api.ts:74](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L74)
+[chatgpt-api.ts:74](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L74)
___
@@ -64,7 +64,7 @@ ___
#### Defined in
-[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L65)
+[chatgpt-api.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L65)
___
@@ -78,7 +78,7 @@ ___
#### Defined in
-[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L165)
+[chatgpt-api.ts:165](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L165)
___
@@ -95,7 +95,7 @@ the response.
| :------ | :------ | :------ |
| `message` | `string` | The plaintext message to send. |
| `opts` | `Object` | - |
-| `opts.conversationId?` | `string` | - |
+| `opts.conversationId?` | `string` | Optional ID of the previous message in a conversation |
| `opts.onProgress?` | (`partialResponse`: `string`) => `void` | - |
#### Returns
@@ -104,4 +104,4 @@ the response.
#### Defined in
-[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/chatgpt-api.ts#L86)
+[chatgpt-api.ts:86](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/chatgpt-api.ts#L86)
diff --git a/legacy/docs/modules.md b/legacy/docs/modules.md
index 388a9b26..8a7b224f 100644
--- a/legacy/docs/modules.md
+++ b/legacy/docs/modules.md
@@ -43,7 +43,7 @@
#### Defined in
-[types.ts:104](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L104)
+[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L109)
___
@@ -53,7 +53,7 @@ ___
#### Defined in
-[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L1)
+[types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L1)
___
@@ -75,7 +75,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in
-[types.ts:129](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L129)
+[types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L134)
___
@@ -93,7 +93,7 @@ ___
#### Defined in
-[types.ts:246](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L246)
+[types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L251)
___
@@ -118,7 +118,7 @@ ___
#### Defined in
-[types.ts:252](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L252)
+[types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L257)
___
@@ -135,7 +135,7 @@ ___
#### Defined in
-[types.ts:265](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L265)
+[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L270)
___
@@ -157,7 +157,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback
#### Defined in
-[types.ts:188](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L188)
+[types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L193)
___
@@ -167,7 +167,7 @@ ___
#### Defined in
-[types.ts:244](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L244)
+[types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L249)
___
@@ -187,7 +187,7 @@ ___
#### Defined in
-[types.ts:217](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L217)
+[types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L222)
___
@@ -197,7 +197,7 @@ ___
#### Defined in
-[types.ts:215](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L215)
+[types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L220)
___
@@ -207,7 +207,7 @@ ___
#### Defined in
-[types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L270)
+[types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L275)
___
@@ -225,7 +225,7 @@ ___
#### Defined in
-[types.ts:72](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L72)
+[types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L77)
___
@@ -243,7 +243,7 @@ https://chat.openapi.com/backend-api/models
#### Defined in
-[types.ts:65](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L65)
+[types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L70)
___
@@ -262,7 +262,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
-[types.ts:92](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L92)
+[types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L97)
___
@@ -282,7 +282,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
-[types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L109)
+[types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L114)
___
@@ -300,7 +300,7 @@ ___
#### Defined in
-[types.ts:156](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L156)
+[types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L161)
___
@@ -317,7 +317,7 @@ ___
#### Defined in
-[types.ts:173](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L173)
+[types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L178)
___
@@ -327,7 +327,7 @@ ___
#### Defined in
-[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L3)
+[types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L3)
___
@@ -342,12 +342,13 @@ https://chat.openapi.com/api/auth/session
| Name | Type | Description |
| :------ | :------ | :------ |
| `accessToken` | `string` | The access token |
+| `error?` | `string` \| ``null`` | If there was an error associated with this request |
| `expires` | `string` | ISO date of the expiration date of the access token |
-| `user` | [`User`](modules.md#user) | Object of the current user |
+| `user` | [`User`](modules.md#user) | Authenticated user |
#### Defined in
-[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L8)
+[types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L8)
___
@@ -369,7 +370,7 @@ ___
#### Defined in
-[types.ts:25](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/types.ts#L25)
+[types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/types.ts#L30)
## Functions
@@ -389,4 +390,4 @@ ___
#### Defined in
-[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/c9cef79/src/utils.ts#L4)
+[utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/cf5e775/src/utils.ts#L4)
diff --git a/legacy/docs/readme.md b/legacy/docs/readme.md
index 3208a7d0..2a41923f 100644
--- a/legacy/docs/readme.md
+++ b/legacy/docs/readme.md
@@ -11,10 +11,10 @@ chatgpt / [Exports](modules.md)
[](https://www.npmjs.com/package/chatgpt) [](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [](https://prettier.io)
- [Intro](#intro)
-- [How it works](#how-it-works)
- [Install](#install)
- [Usage](#usage)
- [Docs](#docs)
+- [How it works](#how-it-works)
- [Examples](#examples)
- [Credit](#credit)
- [License](#license)
@@ -25,34 +25,10 @@ This package is a Node.js wrapper around [ChatGPT](https://openai.com/blog/chatg
You can use it to start building projects powered by ChatGPT like chatbots, websites, etc...
-## How it works
-
-This package requires a valid session token from ChatGPT to access it's unofficial REST API.
-
-To get a session token:
-
-1. Go to https://chat.openai.com/chat and log in or sign up.
-2. Open dev tools.
-3. Open `Application` > `Cookies`.
- 
-4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment.
-
-If you want to run the built-in demo, store this value as `SESSION_TOKEN` in a local `.env` file.
-
-> **Note**
-> This package will switch to using the official API once it's released.
-
-> **Note**
-> Prior to v1.0.0, this package used a headless browser via [Playwright](https://playwright.dev/) to automate the web UI. Here are the [docs for the initial browser version](https://github.com/transitive-bullshit/chatgpt-api/tree/v0.4.2).
-
## Install
```bash
-npm install --save chatgpt
-# or
-yarn add chatgpt
-# or
-pnpm add chatgpt
+npm install chatgpt
```
## Usage
@@ -61,9 +37,10 @@ pnpm add chatgpt
import { ChatGPTAPI } from 'chatgpt'
async function example() {
+ // sessionToken is required; see below for details
const api = new ChatGPTAPI({ sessionToken: process.env.SESSION_TOKEN })
- // ensure the API is properly authenticated (optional)
+ // ensure the API is properly authenticated
await api.ensureAuth()
// send a message and wait for the response
@@ -85,31 +62,53 @@ const api = new ChatGPTAPI({
})
```
-A full [example](./src/example.ts) is included for testing purposes:
+A full [demo](./src/demo.ts) is included for testing purposes:
```bash
# 1. clone repo
# 2. install node deps
# 3. set `SESSION_TOKEN` in .env
# 4. run:
-npx tsx src/example.ts
+npx tsx src/demo.ts
```
## Docs
See the [auto-generated docs](./docs/classes/ChatGPTAPI.md) for more info on methods and parameters.
+## How it works
+
+**This package requires a valid session token from ChatGPT to access it's unofficial REST API.**
+
+To get a session token:
+
+1. Go to https://chat.openai.com/chat and log in or sign up.
+2. Open dev tools.
+3. Open `Application` > `Cookies`.
+ 
+4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment.
+
+If you want to run the built-in demo, store this value as `SESSION_TOKEN` in a local `.env` file.
+
+> **Note**
+> This package will switch to using the official API once it's released.
+
+> **Note**
+> Prior to v1.0.0, this package used a headless browser via [Playwright](https://playwright.dev/) to automate the web UI. Here are the [docs for the initial browser version](https://github.com/transitive-bullshit/chatgpt-api/tree/v0.4.2).
+
## Examples
-All of these awesome projects use the `chatgpt` package. 🤯
+All of these awesome projects are built using the `chatgpt` package. 🤯
- [Twitter Bot](https://github.com/transitive-bullshit/chatgpt-twitter-bot) powered by ChatGPT ✨
- Mention [@ChatGPTBot](https://twitter.com/ChatGPTBot) on Twitter with your prompt to try it out
- [Chrome Extension](https://github.com/gragland/chatgpt-everywhere) ([demo](https://twitter.com/gabe_ragland/status/1599466486422470656))
- [VSCode Extension](https://github.com/mpociot/chatgpt-vscode) ([demo](https://twitter.com/marcelpociot/status/1599180144551526400))
- [Go Telegram Bot](https://github.com/m1guelpf/chatgpt-telegram)
-- [Github ProBot](https://github.com/oceanlvr/ChatGPTBot)
+- [GitHub ProBot](https://github.com/oceanlvr/ChatGPTBot)
+- [Discord Bot](https://github.com/onury5506/Discord-ChatGPT-Bot)
- [Lovelines.xyz](https://lovelines.xyz)
+- [EXM smart contracts](https://github.com/decentldotland/molecule)
If you create a cool integration, feel free to open a PR and add it to the list.
@@ -122,4 +121,4 @@ If you create a cool integration, feel free to open a PR and add it to the list.
MIT © [Travis Fischer](https://transitivebullsh.it)
-Support my open source work by following me on twitter
+If you found this project interesting, please consider supporting my open source work by [sponsoring me](https://github.com/sponsors/transitive-bullshit) or following me on twitter