yxw21 / chatgpt

chatgpt api
9 stars 0 forks source link

Enable Proxies #6

Closed aminalipour closed 1 year ago

aminalipour commented 1 year ago

Hello do you have any plan to support proxies? because it say 429 too many reqs once i send second request thanks

yxw21 commented 1 year ago

I suggest you first confirm if it is an account problem. I have the same problem with my account logging in from a local browser. If it is an account issue you had to change your account.

aminalipour commented 1 year ago

i feel we can bypass it with changing the ip, i already tested, if u add a feature to get proxies array and use randomly in each request will be great, the node js package of chatgpt has this feature

aminalipour commented 1 year ago

chromedp.ProxyServer()

yxw21 commented 1 year ago

Are you sure the proxy can be bypassed? I tried using it on a new ip yesterday and it still prompts me 429, so I logged in in my local browser and found consistent results.

aminalipour commented 1 year ago

Yeah i'm sure, proxy is good feature

yxw21 commented 1 year ago

I'm considering whether cloudflare or chatgpt recognizes tls fingerprints. If the tls fingerprint is added, then the proxy will only introduce other problems.

I gave up using the go client to send chat requests and moved to the browser to avoid tls fingerprinting.

aminalipour commented 1 year ago

429 is happening due to chatgpt not cloudflare something is wrong i tried with an ip and it didnt give me 429 at all, i sent 20 reqs in 5 mins but on another ip it gave 429 after a request

yxw21 commented 1 year ago

I mean I am worried that after adding the proxy, chatgpt will not be able to pass the cloudflare check.

aminalipour commented 1 year ago

so what is your idea to bypass the 429?

yxw21 commented 1 year ago

I will test if adding a proxy will improve it.

aminalipour commented 1 year ago

thanks, may i did and send a pull request

yxw21 commented 1 year ago

yes

yxw21 commented 1 year ago
chromedpundetected.WithChromeFlags(chromedp.Flag("proxy-server", "213.171.63.210:41890"))

Even adding a proxy still does not avoid this problem. I think the cause of 429 could be an ip issue or an account issue. If it is an ip issue you are advised to change the server ip or deploy the application to a new server. If it is an account issue, you can register a new account.

image
yxw21 commented 1 year ago

I got the correct response after trying to change the proxy, so I will add the proxy.

aminalipour commented 1 year ago

i suggest to use this code for enable proxy chromedp.ProxyServer(browserOptions.Proxy) because flags = append(flags, chromedp.Flag("proxy-server", browserOptions.Proxy)) not working well for all proxy (https, ...)

yxw21 commented 1 year ago
// ProxyServer is the command line option to set the outbound proxy server.
func ProxyServer(proxy string) ExecAllocatorOption {
    return Flag("proxy-server", proxy)
}