Commit a4ed68b1 authored by Travis Fischer's avatar Travis Fischer

chore: update auto-generated docs

parent a48c177a
...@@ -52,7 +52,7 @@ to obtain your `clearanceToken`. ...@@ -52,7 +52,7 @@ to obtain your `clearanceToken`.
#### Defined in #### Defined in
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L45) [src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L45)
## Accessors ## Accessors
...@@ -68,7 +68,7 @@ Gets the current Cloudflare clearance token (`cf_clearance` cookie value). ...@@ -68,7 +68,7 @@ Gets the current Cloudflare clearance token (`cf_clearance` cookie value).
#### Defined in #### Defined in
[src/chatgpt-api.ts:136](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L136) [src/chatgpt-api.ts:136](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L136)
___ ___
...@@ -84,7 +84,7 @@ Gets the current session token. ...@@ -84,7 +84,7 @@ Gets the current session token.
#### Defined in #### Defined in
[src/chatgpt-api.ts:131](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L131) [src/chatgpt-api.ts:131](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L131)
___ ___
...@@ -100,7 +100,7 @@ Gets the currently signed-in user, if authenticated, `null` otherwise. ...@@ -100,7 +100,7 @@ Gets the currently signed-in user, if authenticated, `null` otherwise.
#### Defined in #### Defined in
[src/chatgpt-api.ts:126](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L126) [src/chatgpt-api.ts:126](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L126)
___ ___
...@@ -116,7 +116,7 @@ Gets the current user agent. ...@@ -116,7 +116,7 @@ Gets the current user agent.
#### Defined in #### Defined in
[src/chatgpt-api.ts:141](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L141) [src/chatgpt-api.ts:141](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L141)
## Methods ## Methods
...@@ -133,7 +133,7 @@ is still valid. ...@@ -133,7 +133,7 @@ is still valid.
#### Defined in #### Defined in
[src/chatgpt-api.ts:319](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L319) [src/chatgpt-api.ts:319](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L319)
___ ___
...@@ -160,7 +160,7 @@ The new conversation instance ...@@ -160,7 +160,7 @@ The new conversation instance
#### Defined in #### Defined in
[src/chatgpt-api.ts:425](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L425) [src/chatgpt-api.ts:425](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L425)
___ ___
...@@ -177,7 +177,7 @@ the token fails. ...@@ -177,7 +177,7 @@ the token fails.
#### Defined in #### Defined in
[src/chatgpt-api.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L306) [src/chatgpt-api.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L306)
___ ___
...@@ -203,7 +203,7 @@ A valid access token ...@@ -203,7 +203,7 @@ A valid access token
#### Defined in #### Defined in
[src/chatgpt-api.ts:333](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L333) [src/chatgpt-api.ts:333](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L333)
___ ___
...@@ -234,4 +234,4 @@ The response from ChatGPT ...@@ -234,4 +234,4 @@ The response from ChatGPT
#### Defined in #### Defined in
[src/chatgpt-api.ts:166](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-api.ts#L166) [src/chatgpt-api.ts:166](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L166)
...@@ -41,7 +41,7 @@ Creates a new conversation wrapper around the ChatGPT API. ...@@ -41,7 +41,7 @@ Creates a new conversation wrapper around the ChatGPT API.
#### Defined in #### Defined in
[src/chatgpt-conversation.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-conversation.ts#L21) [src/chatgpt-conversation.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L21)
## Properties ## Properties
...@@ -51,7 +51,7 @@ Creates a new conversation wrapper around the ChatGPT API. ...@@ -51,7 +51,7 @@ Creates a new conversation wrapper around the ChatGPT API.
#### Defined in #### Defined in
[src/chatgpt-conversation.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-conversation.ts#L10) [src/chatgpt-conversation.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L10)
___ ___
...@@ -61,7 +61,7 @@ ___ ...@@ -61,7 +61,7 @@ ___
#### Defined in #### Defined in
[src/chatgpt-conversation.ts:11](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-conversation.ts#L11) [src/chatgpt-conversation.ts:11](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L11)
___ ___
...@@ -71,7 +71,7 @@ ___ ...@@ -71,7 +71,7 @@ ___
#### Defined in #### Defined in
[src/chatgpt-conversation.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-conversation.ts#L12) [src/chatgpt-conversation.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L12)
## Methods ## Methods
...@@ -104,4 +104,4 @@ The response from ChatGPT ...@@ -104,4 +104,4 @@ The response from ChatGPT
#### Defined in #### Defined in
[src/chatgpt-conversation.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/chatgpt-conversation.ts#L48) [src/chatgpt-conversation.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L48)
...@@ -66,7 +66,7 @@ node_modules/.pnpm/typescript@4.9.3/node_modules/typescript/lib/lib.es2022.error ...@@ -66,7 +66,7 @@ node_modules/.pnpm/typescript@4.9.3/node_modules/typescript/lib/lib.es2022.error
#### Defined in #### Defined in
[src/types.ts:298](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L298) [src/types.ts:298](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L298)
___ ___
...@@ -76,7 +76,7 @@ ___ ...@@ -76,7 +76,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L297) [src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L297)
___ ___
...@@ -86,7 +86,7 @@ ___ ...@@ -86,7 +86,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L295) [src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L295)
___ ___
...@@ -96,4 +96,4 @@ ___ ...@@ -96,4 +96,4 @@ ___
#### Defined in #### Defined in
[src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L296) [src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L296)
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#### Defined in #### Defined in
[src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L109) [src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L109)
___ ___
...@@ -61,7 +61,7 @@ ___ ...@@ -61,7 +61,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L1) [src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L1)
___ ___
...@@ -83,7 +83,7 @@ https://chat.openapi.com/backend-api/conversation ...@@ -83,7 +83,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in #### Defined in
[src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L134) [src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L134)
___ ___
...@@ -101,7 +101,7 @@ ___ ...@@ -101,7 +101,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L251) [src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L251)
___ ___
...@@ -126,7 +126,7 @@ ___ ...@@ -126,7 +126,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L257) [src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L257)
___ ___
...@@ -136,7 +136,7 @@ ___ ...@@ -136,7 +136,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L276) [src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L276)
___ ___
...@@ -153,7 +153,7 @@ ___ ...@@ -153,7 +153,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L270) [src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L270)
___ ___
...@@ -175,7 +175,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback ...@@ -175,7 +175,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback
#### Defined in #### Defined in
[src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L193) [src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L193)
___ ___
...@@ -185,7 +185,7 @@ ___ ...@@ -185,7 +185,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L249) [src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L249)
___ ___
...@@ -205,7 +205,7 @@ ___ ...@@ -205,7 +205,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L222) [src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L222)
___ ___
...@@ -215,7 +215,7 @@ ___ ...@@ -215,7 +215,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L220) [src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L220)
___ ___
...@@ -225,7 +225,7 @@ ___ ...@@ -225,7 +225,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L275) [src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L275)
___ ___
...@@ -243,7 +243,7 @@ ___ ...@@ -243,7 +243,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L77) [src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L77)
___ ___
...@@ -261,7 +261,7 @@ https://chat.openapi.com/backend-api/models ...@@ -261,7 +261,7 @@ https://chat.openapi.com/backend-api/models
#### Defined in #### Defined in
[src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L70) [src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L70)
___ ___
...@@ -280,7 +280,7 @@ https://chat.openapi.com/backend-api/moderations ...@@ -280,7 +280,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in #### Defined in
[src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L97) [src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L97)
___ ___
...@@ -300,7 +300,7 @@ https://chat.openapi.com/backend-api/moderations ...@@ -300,7 +300,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in #### Defined in
[src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L114) [src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L114)
___ ___
...@@ -322,7 +322,7 @@ to authenticate with the unofficial ChatGPT API. ...@@ -322,7 +322,7 @@ to authenticate with the unofficial ChatGPT API.
#### Defined in #### Defined in
[src/openai-auth.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/openai-auth.ts#L17) [src/openai-auth.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L17)
___ ___
...@@ -340,7 +340,7 @@ ___ ...@@ -340,7 +340,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L161) [src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L161)
___ ___
...@@ -357,7 +357,7 @@ ___ ...@@ -357,7 +357,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L178) [src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L178)
___ ___
...@@ -367,7 +367,7 @@ ___ ...@@ -367,7 +367,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L3) [src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L3)
___ ___
...@@ -377,7 +377,7 @@ ___ ...@@ -377,7 +377,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:289](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L289) [src/types.ts:289](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L289)
___ ___
...@@ -400,7 +400,7 @@ ___ ...@@ -400,7 +400,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L278) [src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L278)
___ ___
...@@ -421,7 +421,7 @@ https://chat.openapi.com/api/auth/session ...@@ -421,7 +421,7 @@ https://chat.openapi.com/api/auth/session
#### Defined in #### Defined in
[src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L8) [src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L8)
___ ___
...@@ -443,7 +443,7 @@ ___ ...@@ -443,7 +443,7 @@ ___
#### Defined in #### Defined in
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/types.ts#L30) [src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L30)
## Functions ## Functions
...@@ -467,7 +467,7 @@ recognizes it and blocks access. ...@@ -467,7 +467,7 @@ recognizes it and blocks access.
#### Defined in #### Defined in
[src/openai-auth.ts:127](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/openai-auth.ts#L127) [src/openai-auth.ts:127](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L127)
___ ___
...@@ -505,7 +505,7 @@ with your updated credentials. ...@@ -505,7 +505,7 @@ with your updated credentials.
#### Defined in #### Defined in
[src/openai-auth.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/openai-auth.ts#L39) [src/openai-auth.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L39)
___ ___
...@@ -525,4 +525,4 @@ ___ ...@@ -525,4 +525,4 @@ ___
#### Defined in #### Defined in
[src/utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/1d621d0/src/utils.ts#L4) [src/utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/utils.ts#L4)
...@@ -4,13 +4,15 @@ chatgpt / [Exports](modules.md) ...@@ -4,13 +4,15 @@ chatgpt / [Exports](modules.md)
Yesterday, OpenAI added additional Cloudflare protections that make it more difficult to access the unofficial API. Yesterday, OpenAI added additional Cloudflare protections that make it more difficult to access the unofficial API.
The demos have been updated to use Puppeteer to log in to ChatGPT and extract the Cloudflare `cf_clearance` cookie and OpenAI session token. 🔥 This package has been updated to use Puppeteer to automatically log in to ChatGPT and extract the necessary auth credentials. 🔥
To use the updated version, make sure you're using the latest version of this package and Node.js >= 18. Then update your code to use the examples below, paying special attention to the sections on [Authentication](#authentication) and [Restrictions](#restrictions). 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 in [this issue](https://github.com/transitive-bullshit/chatgpt-api/issues/96) to improve this process. Keep in mind that this package will be updated to use the official API as soon as it's released. 💪 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. 💪
Cheers, Lastly, please star this repo and <a href="https://twitter.com/transitive_bs">follow me on twitter <img src="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
--- ---
...@@ -47,9 +49,11 @@ You can use it to start building projects powered by ChatGPT like chatbots, webs ...@@ -47,9 +49,11 @@ You can use it to start building projects powered by ChatGPT like chatbots, webs
## Install ## Install
```bash ```bash
npm install chatgpt npm install chatgpt puppeteer
``` ```
`puppeteer` is an optional peer dependency used to automate bypassing the Cloudflare protections via `getOpenAIAuth`. The main API wrapper uses `fetch` directly.
## Usage ## Usage
```ts ```ts
...@@ -161,16 +165,13 @@ npx tsx src/demo-conversation.ts ...@@ -161,16 +165,13 @@ npx tsx src/demo-conversation.ts
### Authentication ### Authentication
#### Restrictions On December 11, 2022, OpenAI added some additional Cloudflare protections which make it more difficult to access the unofficial API.
**Please read carefully** You'll need a valid OpenAI "session token" and Cloudflare "clearance token" in order to use the API.
- 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`). We've provided an automated, Puppeteer-based solution `getOpenAIAuth` to fetch these for you, but you may still run into cases where you have to manually pass the CAPTCHA. We're working on a solution to automate this further.
- Cloudflare `cf_clearance` **tokens expire after 2 hours**, so right now we recommend that you refresh your `cf_clearance` token every hour 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`. You can also get these tokens manually, but keep in mind that the `clearanceToken` only lasts for max 2 hours.
- 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 coming soon.
- 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.
<details> <details>
<summary>Getting tokens manually</summary> <summary>Getting tokens manually</summary>
...@@ -189,6 +190,17 @@ To get a session token manually: ...@@ -189,6 +190,17 @@ To get a session token manually:
> **Note** > **Note**
> This package will switch to using the official API once it's released. > This package will switch to using the official API once it's released.
#### Restrictions
**Please read these carefully**
- You must use `node >= 18` at the moment. I'm using `v19.2.0` in my testing.
- Cloudflare `cf_clearance` **tokens expire after 2 hours**, so right now we recommend that you refresh your `cf_clearance` token every hour 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 coming soon.
- 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.
> **Note** > **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). > 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).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment