From b936a04bce5da449508c4372520db0710ab68214 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 18 Dec 2022 14:23:02 -0800 Subject: [PATCH] docs: update readme for proxy support --- readme.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/readme.md b/readme.md index 8ad3a03..b125ab2 100644 --- a/readme.md +++ b/readme.md @@ -47,6 +47,7 @@ Thanks && cheers, - [Demos](#demos) - [Authentication](#authentication) - [CAPTCHAs](#captchas) + - [Using Proxies](#using-proxies) - [Restrictions](#restrictions) - [Projects](#projects) - [Compatibility](#compatibility) @@ -264,6 +265,22 @@ const api = new ChatGPTAPIBrowser({ }) ``` +### Using Proxies + +The browser implementation supports setting a proxy server. This is useful if you're running into rate limiting issues or if you want to use a proxy to hide your IP address. + +To use a proxy, pass the `proxyServer` option to the `ChatGPTAPIBrowser` constructor, or simply set the `PROXY_SERVER` env var. For more information on the format, see [here](https://www.chromium.org/developers/design-documents/network-settings). + +```ts +const api = new ChatGPTAPIBrowser({ + email: process.env.OPENAI_EMAIL, + password: process.env.OPENAI_PASSWORD, + proxyServer: ':' +}) +``` + +You can also set the `PROXY_VALIDATE_IP` env var to your proxy's IP address. This will be used to validate that the proxy is working correctly, and will throw an error if it's not. + ### Restrictions These restrictions are for the `getOpenAIAuth` + `ChatGPTAPI` solution, which uses the unofficial API. The browser-based solution, `ChatGPTAPIBrowser`, generally doesn't have any of these restrictions.