You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// uses puppeteer to bypass cloudflare (headful because you may have to solve
62
-
// a captcha)
61
+
// use puppeteer to bypass cloudflare (headful because of captchas)
63
62
const openAIAuth =awaitgetOpenAIAuth({
64
63
email: process.env.EMAIL,
65
64
password: process.env.EMAIL
@@ -174,19 +173,22 @@ You can also get these tokens manually, but keep in mind that the `clearanceToke
174
173
<details>
175
174
<summary>Getting tokens manually</summary>
176
175
177
-
To get a session token manually:
176
+
To get session token manually:
178
177
179
178
1. Go to https://chat.openai.com/chat and log in or sign up.
180
179
2. Open dev tools.
181
180
3. Open `Application` > `Cookies`.
182
181

183
182
4. Copy the value for `__Secure-next-auth.session-token` and save it to your environment. This will be your `sessionToken`.
184
183
5. Copy the value for `cf_clearance` and save it to your environment. This will be your `clearanceToken`.
184
+
6. Copy the value of the `user-agent` header from any request in your `Network` tab. This will be your `userAgent`.
185
+
186
+
Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` constructor.
185
187
186
188
</details>
187
189
188
190
> **Note**
189
-
> This package will switch to using the official API once it's released.
191
+
> This package will switch to using the official API once it's released, which will make this process much simpler.
190
192
191
193
#### Restrictions
192
194
@@ -254,15 +256,14 @@ If you create a cool integration, feel free to open a PR and add it to the list.
254
256
This package is ESM-only. It supports:
255
257
256
258
- Node.js >= 18
257
-
- Node.js 17, 16, and 14 were supported in earlier versions, but OpenAI's Cloudflare update caused a bug with `undici` on v17 and v16 that we need to debug. So for now, use `node >= 18`
258
-
- We recommend against using `chatgpt` from client-side browser code because it would expose your private session token
259
-
- If you want to build a website using `chatgpt`, we recommend using it only from your backend API
259
+
- Node.js 17, 16, and 14 were supported in earlier versions, but OpenAI's Cloudflare update caused a bug with `undici` on v17 and v16 that needs investigation. So for now, use `node >= 18`
260
+
- We recommend against using `chatgpt` from client-side browser code because it would expose your private session token
261
+
- If you want to build a website using `chatgpt`, we recommend using it only from your backend API
260
262
261
263
## Credits
262
264
263
-
- Huge thanks to [@simon300000](https://github.com/simon300000), [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), and all the other contributors 💪
265
+
- Huge thanks to [@wong2](https://github.com/wong2), [@simon300000](https://github.com/simon300000), [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), and all the other contributors 💪
264
266
- The original browser version was inspired by this [Go module](https://github.com/danielgross/whatsapp-gpt) by [Daniel Gross](https://github.com/danielgross)
265
-
- The original REST version was inspired by [chat-gpt-google-extension](https://github.com/wong2/chat-gpt-google-extension) by [@wong2](https://github.com/wong2)
266
267
-[OpenAI](https://openai.com) for creating [ChatGPT](https://openai.com/blog/chatgpt/) 🔥
0 commit comments