docs: rename OPENAI_EMAIL and OPENAI_PASSWORD env variables

pull/116/head
Travis Fischer 2022-12-12 17:23:36 -06:00
rodzic c257286769
commit ef15db3a0c
9 zmienionych plików z 81 dodań i 81 usunięć

Wyświetl plik

@ -9,5 +9,5 @@
# ChatGPT
# -----------------------------------------------------------------------------
EMAIL=
PASSWORD=
OPENAI_EMAIL=
OPENAI_PASSWORD=

Wyświetl plik

@ -13,8 +13,8 @@ dotenv.config()
* ```
*/
async function main() {
const email = process.env.EMAIL
const password = process.env.PASSWORD
const email = process.env.OPENAI_EMAIL
const password = process.env.OPENAI_PASSWORD
const authInfo = await getOpenAIAuth({
email,

Wyświetl plik

@ -13,8 +13,8 @@ dotenv.config()
* ```
*/
async function main() {
const email = process.env.EMAIL
const password = process.env.PASSWORD
const email = process.env.OPENAI_EMAIL
const password = process.env.OPENAI_PASSWORD
const authInfo = await getOpenAIAuth({
email,

Wyświetl plik

@ -52,7 +52,7 @@ to obtain your `clearanceToken`.
#### Defined in
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L45)
[src/chatgpt-api.ts:45](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L45)
## Accessors
@ -68,7 +68,7 @@ Gets the current Cloudflare clearance token (`cf_clearance` cookie value).
#### Defined in
[src/chatgpt-api.ts:136](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L136)
[src/chatgpt-api.ts:136](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L136)
___
@ -84,7 +84,7 @@ Gets the current session token.
#### Defined in
[src/chatgpt-api.ts:131](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L131)
[src/chatgpt-api.ts:131](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L131)
___
@ -100,7 +100,7 @@ Gets the currently signed-in user, if authenticated, `null` otherwise.
#### Defined in
[src/chatgpt-api.ts:126](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L126)
[src/chatgpt-api.ts:126](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L126)
___
@ -116,7 +116,7 @@ Gets the current user agent.
#### Defined in
[src/chatgpt-api.ts:141](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L141)
[src/chatgpt-api.ts:141](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L141)
## Methods
@ -133,7 +133,7 @@ is still valid.
#### Defined in
[src/chatgpt-api.ts:319](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L319)
[src/chatgpt-api.ts:319](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L319)
___
@ -160,7 +160,7 @@ The new conversation instance
#### Defined in
[src/chatgpt-api.ts:425](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L425)
[src/chatgpt-api.ts:425](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L425)
___
@ -177,7 +177,7 @@ the token fails.
#### Defined in
[src/chatgpt-api.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L306)
[src/chatgpt-api.ts:306](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L306)
___
@ -203,7 +203,7 @@ A valid access token
#### Defined in
[src/chatgpt-api.ts:333](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L333)
[src/chatgpt-api.ts:333](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L333)
___
@ -234,4 +234,4 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-api.ts:166](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-api.ts#L166)
[src/chatgpt-api.ts:166](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-api.ts#L166)

Wyświetl plik

@ -41,7 +41,7 @@ Creates a new conversation wrapper around the ChatGPT API.
#### Defined in
[src/chatgpt-conversation.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L21)
[src/chatgpt-conversation.ts:21](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-conversation.ts#L21)
## Properties
@ -51,7 +51,7 @@ Creates a new conversation wrapper around the ChatGPT API.
#### Defined in
[src/chatgpt-conversation.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L10)
[src/chatgpt-conversation.ts:10](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-conversation.ts#L10)
___
@ -61,7 +61,7 @@ ___
#### Defined in
[src/chatgpt-conversation.ts:11](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L11)
[src/chatgpt-conversation.ts:11](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-conversation.ts#L11)
___
@ -71,7 +71,7 @@ ___
#### Defined in
[src/chatgpt-conversation.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L12)
[src/chatgpt-conversation.ts:12](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-conversation.ts#L12)
## Methods
@ -104,4 +104,4 @@ The response from ChatGPT
#### Defined in
[src/chatgpt-conversation.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/chatgpt-conversation.ts#L48)
[src/chatgpt-conversation.ts:48](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/chatgpt-conversation.ts#L48)

Wyświetl plik

@ -66,7 +66,7 @@ node_modules/.pnpm/typescript@4.9.3/node_modules/typescript/lib/lib.es2022.error
#### Defined in
[src/types.ts:298](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L298)
[src/types.ts:298](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L298)
___
@ -76,7 +76,7 @@ ___
#### Defined in
[src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L297)
[src/types.ts:297](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L297)
___
@ -86,7 +86,7 @@ ___
#### Defined in
[src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L295)
[src/types.ts:295](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L295)
___
@ -96,4 +96,4 @@ ___
#### Defined in
[src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L296)
[src/types.ts:296](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L296)

Wyświetl plik

@ -51,7 +51,7 @@
#### Defined in
[src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L109)
[src/types.ts:109](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L109)
___
@ -61,7 +61,7 @@ ___
#### Defined in
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L1)
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L1)
___
@ -83,7 +83,7 @@ https://chat.openapi.com/backend-api/conversation
#### Defined in
[src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L134)
[src/types.ts:134](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L134)
___
@ -101,7 +101,7 @@ ___
#### Defined in
[src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L251)
[src/types.ts:251](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L251)
___
@ -126,7 +126,7 @@ ___
#### Defined in
[src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L257)
[src/types.ts:257](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L257)
___
@ -136,7 +136,7 @@ ___
#### Defined in
[src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L276)
[src/types.ts:276](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L276)
___
@ -153,7 +153,7 @@ ___
#### Defined in
[src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L270)
[src/types.ts:270](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L270)
___
@ -175,7 +175,7 @@ https://chat.openapi.com/backend-api/conversation/message_feedback
#### Defined in
[src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L193)
[src/types.ts:193](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L193)
___
@ -185,7 +185,7 @@ ___
#### Defined in
[src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L249)
[src/types.ts:249](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L249)
___
@ -205,7 +205,7 @@ ___
#### Defined in
[src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L222)
[src/types.ts:222](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L222)
___
@ -215,7 +215,7 @@ ___
#### Defined in
[src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L220)
[src/types.ts:220](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L220)
___
@ -225,7 +225,7 @@ ___
#### Defined in
[src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L275)
[src/types.ts:275](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L275)
___
@ -243,7 +243,7 @@ ___
#### Defined in
[src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L77)
[src/types.ts:77](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L77)
___
@ -261,7 +261,7 @@ https://chat.openapi.com/backend-api/models
#### Defined in
[src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L70)
[src/types.ts:70](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L70)
___
@ -280,7 +280,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L97)
[src/types.ts:97](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L97)
___
@ -300,7 +300,7 @@ https://chat.openapi.com/backend-api/moderations
#### Defined in
[src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L114)
[src/types.ts:114](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L114)
___
@ -322,7 +322,7 @@ to authenticate with the unofficial ChatGPT API.
#### Defined in
[src/openai-auth.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L17)
[src/openai-auth.ts:17](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/openai-auth.ts#L17)
___
@ -340,7 +340,7 @@ ___
#### Defined in
[src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L161)
[src/types.ts:161](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L161)
___
@ -357,7 +357,7 @@ ___
#### Defined in
[src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L178)
[src/types.ts:178](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L178)
___
@ -367,7 +367,7 @@ ___
#### Defined in
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L3)
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L3)
___
@ -377,7 +377,7 @@ ___
#### Defined in
[src/types.ts:289](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L289)
[src/types.ts:289](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L289)
___
@ -400,7 +400,7 @@ ___
#### Defined in
[src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L278)
[src/types.ts:278](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L278)
___
@ -421,7 +421,7 @@ https://chat.openapi.com/api/auth/session
#### Defined in
[src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L8)
[src/types.ts:8](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L8)
___
@ -443,7 +443,7 @@ ___
#### Defined in
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/types.ts#L30)
[src/types.ts:30](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/types.ts#L30)
## Functions
@ -467,7 +467,7 @@ recognizes it and blocks access.
#### Defined in
[src/openai-auth.ts:127](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L127)
[src/openai-auth.ts:127](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/openai-auth.ts#L127)
___
@ -505,7 +505,7 @@ with your updated credentials.
#### Defined in
[src/openai-auth.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/openai-auth.ts#L39)
[src/openai-auth.ts:39](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/openai-auth.ts#L39)
___
@ -525,4 +525,4 @@ ___
#### Defined in
[src/utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/a48c177/src/utils.ts#L4)
[src/utils.ts:4](https://github.com/transitive-bullshit/chatgpt-api/blob/c257286/src/utils.ts#L4)

Wyświetl plik

@ -1,6 +1,6 @@
chatgpt / [Exports](modules.md)
# Update December 12, 2022
# Update December 12, 2022 <!-- omit in toc -->
Yesterday, OpenAI added additional Cloudflare protections that make it more difficult to access the unofficial API.
@ -10,7 +10,7 @@ To use the updated version, **make sure you're using the latest version of this
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. 💪
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.
Lastly, please consider starring this repo and <a href="https://twitter.com/transitive_bs">following 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
@ -27,18 +27,17 @@ Travis
[![NPM](https://img.shields.io/npm/v/chatgpt.svg)](https://www.npmjs.com/package/chatgpt) [![Build Status](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml/badge.svg)](https://github.com/transitive-bullshit/chatgpt-api/actions/workflows/test.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue)](https://github.com/transitive-bullshit/chatgpt-api/blob/main/license) [![Prettier Code Formatting](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)
- [Update December 12, 2022](#update-december-12-2022)
- [Intro](#intro)
- [Install](#install)
- [Usage](#usage)
- [Docs](#docs)
- [Demos](#demos)
- [Authentication](#authentication)
- [Restrictions](#restrictions)
- [Projects](#projects)
- [Compatibility](#compatibility)
- [Credits](#credits)
- [License](#license)
- [Intro](#intro)
- [Install](#install)
- [Usage](#usage)
- [Docs](#docs)
- [Demos](#demos)
- [Authentication](#authentication)
- [Restrictions](#restrictions)
- [Projects](#projects)
- [Compatibility](#compatibility)
- [Credits](#credits)
- [License](#license)
## Intro
@ -60,11 +59,10 @@ npm install chatgpt puppeteer
import { ChatGPTAPI, getOpenAIAuth } from 'chatgpt'
async function example() {
// uses puppeteer to bypass cloudflare (headful because you may have to solve
// a captcha)
// use puppeteer to bypass cloudflare (headful because of captchas)
const openAIAuth = await getOpenAIAuth({
email: process.env.EMAIL,
password: process.env.EMAIL
email: process.env.OPENAI_EMAIL,
password: process.env.OPENAI_PASSWORD
})
const api = new ChatGPTAPI({ ...openAIAuth })
@ -125,8 +123,8 @@ async function example() {
const { ChatGPTAPI, getOpenAIAuth } = await import('chatgpt')
const openAIAuth = await getOpenAIAuth({
email: process.env.EMAIL,
password: process.env.EMAIL
email: process.env.OPENAI_EMAIL,
password: process.env.OPENAI_PASSWORD
})
const api = new ChatGPTAPI({ ...openAIAuth })
@ -149,7 +147,7 @@ To run the included demos:
1. clone repo
2. install node deps
3. set `EMAIL` and `PASSWORD` in .env
3. set `OPENAI_EMAIL` and `OPENAI_PASSWORD` in .env
A [basic demo](./demos/demo.ts) is included for testing purposes:
@ -176,7 +174,7 @@ You can also get these tokens manually, but keep in mind that the `clearanceToke
<details>
<summary>Getting tokens manually</summary>
To get a session token manually:
To get session token manually:
1. Go to https://chat.openai.com/chat and log in or sign up.
2. Open dev tools.
@ -184,11 +182,14 @@ To get a session token manually:
![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`.
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`.
Pass `sessionToken`, `clearanceToken`, and `userAgent` to the `ChatGPTAPI` constructor.
</details>
> **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, which will make this process much simpler.
#### Restrictions
@ -256,15 +257,14 @@ If you create a cool integration, feel free to open a PR and add it to the list.
This package is ESM-only. It supports:
- Node.js >= 18
- 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`
- We recommend against using `chatgpt` from client-side browser code because it would expose your private session token
- If you want to build a website using `chatgpt`, we recommend using it only from your backend API
- 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`
- We recommend against using `chatgpt` from client-side browser code because it would expose your private session token
- If you want to build a website using `chatgpt`, we recommend using it only from your backend API
## Credits
- Huge thanks to [@simon300000](https://github.com/simon300000), [@RomanHotsiy](https://github.com/RomanHotsiy), [@ElijahPepe](https://github.com/ElijahPepe), and all the other contributors 💪
- 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 💪
- The original browser version was inspired by this [Go module](https://github.com/danielgross/whatsapp-gpt) by [Daniel Gross](https://github.com/danielgross)
- 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)
- [OpenAI](https://openai.com) for creating [ChatGPT](https://openai.com/blog/chatgpt/) 🔥
## License

Wyświetl plik

@ -145,7 +145,7 @@ To run the included demos:
1. clone repo
2. install node deps
3. set `EMAIL` and `PASSWORD` in .env
3. set `OPENAI_EMAIL` and `OPENAI_PASSWORD` in .env
A [basic demo](./demos/demo.ts) is included for testing purposes: