acheong08 / ChatGPT

Reverse engineered ChatGPT API
GNU General Public License v2.0
28.04k stars 4.48k forks source link

[Bug]:OpenAI: {"detail":"Our systems have detected unusual activity from your system. Please try again later."} (code: 403) Once Again Not Solved #1431

Open SwimmingLiu opened 1 year ago

SwimmingLiu commented 1 year ago

Is there an existing issue for this?

What happened?

Dingtalk_20230620084507

Steps to reproduce the problem

Try to run ask() with V1 API.

What should have happened?

Is should work:)

Version where the problem happens

Tried 6.3.4(latest)

What Python version are you running this with?

3.9

What is your operating system ?

Linux

Command Line Arguments

No

Console logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 726, in __check_response
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://bypass.churchless.tech/conversation

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/gpt4_test.py", line 222, in <module>
    get_slice_thread_io(token)
  File "/root/gpt4_test.py", line 200, in get_slice_thread_io
    get_content(token[0], server)
  File "/root/gpt4_test.py", line 148, in get_content
    for data in chatbot.ask(prompt):
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 608, in ask
    yield from self.post_messages(
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 561, in post_messages
    yield from self.__send_request(
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 392, in __send_request
    self.__check_response(response)
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 91, in wrapper
    out = func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/revChatGPT/V1.py", line 733, in __check_response
    raise error from ex
revChatGPT.typings.Error: OpenAI: {"detail":"Our systems have detected unusual activity from your system. Please try again later."} (code: 403)

Additional information

No response

wangjiyang commented 1 year ago

Same issue here.

moejay commented 1 year ago

Am having the same issue, works for gpt 3.5 model

SwimmingLiu commented 1 year ago

it doesn't work bro

acheong08 commented 1 year ago

"works on my computer"

acheong08 commented 1 year ago

Try gpt-4-mobile as your model and see if anything changes

wangjiyang commented 1 year ago

@acheong08 your fix works on my computer with latest change.

SwimmingLiu commented 1 year ago

Try gpt-4-mobile as your model and see if anything changes

this model makes it work, thx sir!!

wangjiyang commented 1 year ago

@acheong08 your fix works on my computer with latest change.

gpt-4-mobile may be the final fix, whereas __arkose_token method only works for several hours.

wong2 commented 1 year ago

I believe they will add the arkose_token based verification to mobile models soon.

Nadeus commented 1 year ago

Is there a difference between gpt-4 and gpt-4-mobile?

acheong08 commented 1 year ago

Is there a difference between gpt-4 and gpt-4-mobile?

No

madela commented 1 year ago

Is there a difference between gpt-4 and gpt-4-mobile?

I have tested between gpt-4 and gpt-4-mobile and found differences in reasoning and writing style. gpt-4 looks much more advanced for long text.

rvadhavk commented 1 year ago

I've also found that for summarization of long text, gpt-4-mobile is far worse than both gpt-4 and text-davinci-002-render-sha

Nadeus commented 1 year ago

Ok i'm now having the error with gpt-4-mobile, am I the only one?

So now both gpt-4 models don't work :/

otaviobhz commented 1 year ago

I am facing the same problem.

3mora2 commented 1 year ago

reason may be here

It appears that an arkose_token field has been added to each ChatGPT conversation request, and currently only GPT-4 models are validating this field.

When a conversation is initiated from the GPT-3.5 page, the arkose_token is null. However, when a conversation is initiated from the GPT-4 page, an automatic request is made to fetch this arkose_token, which is then included in the conversation request.

It seems this is part of the Arkose FunCAPTCHA challenge process. However, the GPT-4 Mobile model isn't checking for this field at this time. As a workaround, you might want to use the GPT-4 Mobile model, which does not have usage restrictions at present.

3mora2 commented 1 year ago

comment

# if data.get("model", "").startswith("gpt-4"):
#     data["arkose_token"] = self.__arkose_token()

in def __send_request, it work for me

hydrotho commented 1 year ago

reason may be here

It appears that an arkose_token field has been added to each ChatGPT conversation request, and currently only GPT-4 models are validating this field. When a conversation is initiated from the GPT-3.5 page, the arkose_token is null. However, when a conversation is initiated from the GPT-4 page, an automatic request is made to fetch this arkose_token, which is then included in the conversation request. It seems this is part of the Arkose FunCAPTCHA challenge process. However, the GPT-4 Mobile model isn't checking for this field at this time. As a workaround, you might want to use the GPT-4 Mobile model, which does not have usage restrictions at present.

Thanks for referencing my previous reply. However, it's important to note that some information has become outdated. Currently, all GPT-4 models, including the GPT-4 Mobile model, are validating the arkose_token field.

I've addressed this issue at hydrotho/ChatGPT_Model_Switcher#2. The fix appears to be working well at the moment. However, please be aware that it might become ineffective at some point in the future due to potential changes in ChatGPT.

wangjiyang commented 1 year ago

by applying "gpt-4-mobile" patch, it worked for 4 days. This issue happens again. So gpt-4-mobile is not a final fix. will try @hydrotho 's method.

@acheong08 your fix works on my computer with latest change.

gpt-4-mobile may be the final fix, whereas __arkose_token method only works for several hours.

luluhuhu commented 1 year ago

gpt-4-mobile also reported 403 error

acheong08 commented 1 year ago

RIP my borrowed plus account expired

acheong08 commented 1 year ago

Which means the PUID is invalid for GPT-4 access

acheong08 commented 1 year ago

Can anyone share a PUID?

WhiteCranes commented 1 year ago

Can anyone share a PUID?

user-EW05FrqHnXwezENAhzlji1Fu:1687574587-vaKR9vKqhkcDEgh7ra3ytPYngcuoqKDQ7yfAZrrCr%2Bc%3D

WhiteCranes commented 1 year ago

Can anyone share a PUID?

give me a way to contact you,I can lend you a plus account

acheong08 commented 1 year ago

Matrix: https://matrix.to/#/@acheong08:matrix.duti.me Discord: acheong08 Twitter: acheong08

acheong08 commented 1 year ago

Since I don't have access to GPT-4 I can't test my patches. Based on observations of the web requests, arkose token is required, and either

  1. PUID must match access token
  2. arkose token must be fetched by matching IP
WhiteCranes commented 1 year ago

Matrix: https://matrix.to/#/@acheong08:matrix.duti.me Discord: acheong08 Twitter: acheong08 i send message to your Matrix

acheong08 commented 1 year ago

Updated PUID on server thanks to @WhiteCranes

Try and see if it works now

gchust commented 1 year ago

@acheong08 "bda": str(base64.b64encode(b'{"ct":"","iv":"","s":""}'), "utf-8") This bda is not working for me. (Any other people tried 6.4.2 revChatGPT?)

However, I found that the solution in this repo is working https://github.com/saeedezzati/superpower-chatgpt/commit/cbb182ea0dd9b6875ab0adb7b14ba2b520aad83f#diff-4dcce6c0d0a57cdca60dbc5551021cce5ab858d68da3a15d6fe2a9afa934c722

superpower-chatgpt is retrieving the arkso token from the following endpoint`

curl -i -X GET \
   -H "Origin:https://chat.openai.com" \
 'https://api.wfh.team/gptx/arkose/'

Not sure if the token getting from the above API will expire or not, but it is working for the moment.

https://api.wfh.team/gptx/arkose/ is not open source, so I don't know why it is working šŸ˜µā€šŸ’«

GP1390 commented 1 year ago

@acheong08 "bda": str(base64.b64encode(b'{"ct":"","iv":"","s":""}'), "utf-8") This bda is not working for me. (Any other people tried 6.4.2 revChatGPT?)

However, I found that the solution in this repo is working saeedezzati/superpower-chatgpt@cbb182e#diff-4dcce6c0d0a57cdca60dbc5551021cce5ab858d68da3a15d6fe2a9afa934c722

superpower-chatgpt is retrieving the arkso token from the following endpoint`

curl -i -X GET \
   -H "Origin:https://chat.openai.com" \
 'https://api.wfh.team/gptx/arkose/'

Not sure if the token getting from the above API will expire or not, but it is working for the moment.

https://api.wfh.team/gptx/arkose/ is not open source, so I don't know why it is working šŸ˜µā€šŸ’«

Yepļ¼ŒI tried 6.4.2 revChatGPT. But neither 6.4.2 revChatGPT nor the token get from https://api.wfh.team/gptx/arkose/ works for me šŸ˜µā€šŸ’«

wangjiyang commented 1 year ago

6.4.2 not working for me either.

acheong08 commented 1 year ago

Arkose token might be regional then. I'll implement server side fetching of arkose.

acheong08 commented 1 year ago

Try https://github.com/acheong08/ChatGPT/releases/tag/6.4.3 to see if the system tries to link PUID with access token + arkose token

(This update fetches the PUID cookie automatically)

acheong08 commented 1 year ago

(wait a bit. server updating)

acheong08 commented 1 year ago

Server updated. Will now use its own arkose token

wangjiyang commented 1 year ago

use a dedicated "bda" with the corresponding "userbrowser" can work. It seems my bda generation is not following this algorithm: "str(base64.b64encode(b'{"ct":"","iv":"","s":""}'), "utf-8"),".

acheong08 commented 1 year ago

I haven't been able to figure out how bda is generated. Not sure if hardcoding one works

acheong08 commented 1 year ago

https://github.com/acheong08/ChatGPT-Proxy-V4/blob/df2fb77b0158d99071a8ebc00fdea88fcf68459c/arkose.go#L1-L44

acheong08 commented 1 year ago

At least for my own computer, it works right now with server side arkose

acheong08 commented 1 year ago

Not sure how long it'll last

acheong08 commented 1 year ago

This thread is useful. https://github.com/linweiyuan/go-chatgpt-api/issues/175

My Chinese is sadly not proficient enough to understand

wangjiyang commented 1 year ago

This thread is useful. linweiyuan/go-chatgpt-api#175

My Chinese is sadly not proficient enough to understand

linwenyuan said use this url as can generate correct arkose-token https://arkose-token.linweiyuan.com Seems not useful for this repo.

wangjiyang commented 1 year ago

This thread is useful. linweiyuan/go-chatgpt-api#175 My Chinese is sadly not proficient enough to understand

linwenyuan said use this url as can generate correct arkose-token https://arkose-token.linweiyuan.com Seems not useful for this repo.

Seems we should generate arkoseToken is proxy server, accoring to his patchset

if arkoseTokenUrl != "" {
            req, _ := http.NewRequest(http.MethodGet, arkoseTokenUrl, nil)
            resp, err := api.Client.Do(req)
            if err != nil || resp.StatusCode != http.StatusOK {
                c.AbortWithStatusJSON(http.StatusInternalServerError, api.ReturnMessage("Failed to get arkose token."))
                return
            }
responseMap := make(map[string]string)
            json.NewDecoder(resp.Body).Decode(&responseMap)
            request.ArkoseToken = responseMap["token"]
        }
acheong08 commented 1 year ago

Seems we should generate arkoseToken is proxy server, accoring to his patchset

https://github.com/acheong08/ChatGPT-Proxy-V4/blob/df2fb77b0158d99071a8ebc00fdea88fcf68459c/arkose.go#L1-L44

Already doing that (since a couple minutes ago)

acheong08 commented 1 year ago

Can you check if it works for you? (Also upgrade to latest version of revChatGPT so arkose doesn't get overriden by client)

acheong08 commented 1 year ago

Works for me but since I'm in the same region as the proxy server, it might or might not be replicable by others

wangjiyang commented 1 year ago

Works for me but since I'm in the same region as the proxy server, it might or might not be replicable by others

Yes. It works for me either. This may be the final fix. Thanks.

GP1390 commented 1 year ago

Works for me but since I'm in the same region as the proxy server, it might or might not be replicable by others

Upgrade both and it did work for the moment, proxy server of ap-southeast region. Thanks!

acheong08 commented 1 year ago

Confirmed working for non-southeast accounts as well now (off thread)