Note that this solution is not lightweight, but it does work a lot more consistently than the REST API-based versions. I'm currently using this solution to power 10 OpenAI accounts concurrently across 10 minimized Chrome windows for my [Twitter bot](https://github.com/transitive-bullshit/chatgpt-twitter-bot). 😂
If you get a "ChatGPT is at capacity" error when logging in, note that this is also happening quite frequently on the official webapp. Their servers are overloaded, and we're all trying our best to offer access to this amazing technology.
To use the updated version, **make sure you're using the latest version of this package and Node.js >= 18**. Then update your code following the examples below, paying special attention to the sections on [Authentication](#authentication) and [Restrictions](#restrictions).
We're working hard to improve this process (especially CAPTCHA automation). Keep in mind that this package will be updated to use the official API as soon as it's released, so things should get much easier over time. 💪
...
...
@@ -11,7 +33,8 @@ We're working hard to improve this process (especially CAPTCHA automation). Keep
Lastly, please consider starring this repo and <ahref="https://twitter.com/transitive_bs">following me on twitter <imgsrc="https://storage.googleapis.com/saasify-assets/twitter-logo.svg"alt="twitter"height="24px"align="center"></a> to help support the project.
Thanks && cheers,
Travis
[Travis](https://twitter.com/transitive_bs)
---
...
...
@@ -76,6 +99,25 @@ async function example() {
}
```
Or, if you want to try the full browser-based solution:
```ts
import{ChatGPTAPIBrowser}from'chatgpt'
asyncfunctionexample(){
// use puppeteer to bypass cloudflare (headful because of captchas)
ChatGPT responses are formatted as markdown by default. If you want to work with plaintext instead, you can use:
```ts
...
...
@@ -191,6 +233,8 @@ Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` const
### Restrictions
These restrictions are for the `getOpenAIAuth` + `ChatGPTAPI` solution, which uses the unofficial API. The browser-based solution, `ChatGPTAPIBrowser`, doesn't have many of these restrictions, though you'll still have to manually bypass CAPTCHAs by hand.
**Please read carefully**
- You must use `node >= 18` at the moment. I'm using `v19.2.0` in my testing.