@@ -205,12 +205,6 @@ A [conversation demo](./demos/demo-conversation.ts) is also included:
...
@@ -205,12 +205,6 @@ A [conversation demo](./demos/demo-conversation.ts) is also included:
npx tsx demos/demo-conversation.ts
npx tsx demos/demo-conversation.ts
```
```
A [browser-based conversation demo](./demos/demo-conversation-browser.ts) is also included:
```bash
npx tsx demos/demo-conversation-browser.ts
```
### Authentication
### Authentication
The authentication section relates to the REST-based version (using `getOpenAIAuth` + `ChatGPTAPI`). The browser-based solution, `ChatGPTAPIBrowser`, takes care of all the authentication for you.
The authentication section relates to the REST-based version (using `getOpenAIAuth` + `ChatGPTAPI`). The browser-based solution, `ChatGPTAPIBrowser`, takes care of all the authentication for you.
...
@@ -234,7 +228,7 @@ To get session token manually:
...
@@ -234,7 +228,7 @@ To get session token manually:
![ChatGPT cookies](./media/session-token.png)
![ChatGPT cookies](./media/session-token.png)
4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment. This will be your `sessionToken`.
4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment. This will be your `sessionToken`.
5. Copy the value for `cf_clearance` and save it to your environment. This will be your `clearanceToken`.
5. Copy the value for `cf_clearance` and save it to your environment. This will be your `clearanceToken`.
6. Copy the value of the `user-agent` header from any request in your `Network` tab. This will be your `userAgent`.
6. Copy the value of the `user-agent` header from any request in your `Network` tab, or copy the result of `navigator.userAgent` command on `Console` tab. This will be your `userAgent`.
Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` constructor.
Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` constructor.
...
@@ -315,8 +309,11 @@ All of these awesome projects are built using the `chatgpt` package. 🤯
...
@@ -315,8 +309,11 @@ All of these awesome projects are built using the `chatgpt` package. 🤯