kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
docs: update readme status
rodzic
93ab8e77eb
commit
62bdbd8ebb
21
readme.md
21
readme.md
|
@ -1,22 +1,16 @@
|
|||
# Update December 11, 2022
|
||||
# Update December 12, 2022
|
||||
|
||||
Today, OpenAI added additional Cloudflare protections that make it more difficult to access the unofficial API. _This is affecting all ChatGPT API wrappers at the moment_, including the Python ones. See [this issue](https://github.com/transitive-bullshit/chatgpt-api/issues/96).
|
||||
Yesterday, OpenAI added additional Cloudflare protections that make it more difficult to access the unofficial API.
|
||||
|
||||
**As a temporary workaround**, make sure you're using the latest version of this package and Node.js >= 18:
|
||||
The demos have been updated to use Puppeteer to log in to ChatGPT and extract the Cloudflare `cf_clearance` cookie and OpenAI session token. 🔥
|
||||
|
||||
1. Log into https://chat.openai.com/chat and copy a fresh session token (same instructions as below).
|
||||
|
||||
2. Copy the value of the `cf_clearance` cookie and store it in a `CLEARANCE_TOKEN` environment variable in addition to your `SESSION_TOKEN`.
|
||||
|
||||
3. Copy your browser's `user-agent` header from any request in your browser's network tab.
|
||||
|
||||
4. Use both tokens when creating the API wrapper:
|
||||
To use the updated version, first make sure you're using the latest version of this package and Node.js >= 18:
|
||||
|
||||
```ts
|
||||
const api = new ChatGPTApI({
|
||||
sessionToken: process.env.SESSION_TOKEN,
|
||||
clearanceToken: process.env.CLEARANCE_TOKEN,
|
||||
userAgent: '' // replace to match your real browser's user agent
|
||||
userAgent: '' // needs to match your browser's user agent
|
||||
})
|
||||
|
||||
await api.ensureAuth()
|
||||
|
@ -24,9 +18,10 @@ await api.ensureAuth()
|
|||
|
||||
Restrictions on this method:
|
||||
|
||||
- Cloudflare `cf_clearance` **tokens expire after 2 hours**, so right now you'll have to manually log in and extract it by hand every so often
|
||||
- Cloudflare `cf_clearance` **tokens expire after 2 hours**, so right now we recommend that you refresh your `cf_clearance` token every ~45 minutes or so.
|
||||
- Your `user-agent` and `IP address` **must match** from the real browser window you're logged in with to the one you're using for `ChatGPTAPI`.
|
||||
- This means that you currently can't log in with your laptop and then run the bot on a server or proxy somewhere.
|
||||
- Cloudflare will still sometimes ask you to complete a CAPTCHA, so you may need to keep an eye on it and manually resolve the CAPTCHA. Automated CAPTCHA bypass is a WIP.
|
||||
- You must use `node >= 18`. I'm using `v19.2.0` in my testing, but for some reason, all `fetch` requests using Node.js `v16` and `v17` fail at the moment (these use `undici` under the hood, whereas Node.js v18 and above use a built-in `fetch` based on `undici`).
|
||||
- You should not be using this account while the bot is using it, because that browser window may refresh one of your tokens and invalidate the bot's session.
|
||||
|
||||
|
@ -47,7 +42,7 @@ Travis
|
|||
|
||||
[](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)
|
||||
|
||||
- [Update December 11, 2022](#update-december-11-2022)
|
||||
- [Update December 12, 2022](#update-december-12-2022)
|
||||
- [Intro](#intro)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
|
|
Ładowanie…
Reference in New Issue