Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arkoke token not found in .har file #2087

Closed
Baldi89989 opened this issue Jun 30, 2024 · 40 comments
Closed

Arkoke token not found in .har file #2087

Baldi89989 opened this issue Jun 30, 2024 · 40 comments
Assignees
Labels
bug Something isn't working stale

Comments

@Baldi89989
Copy link

Bug description
When using open ai chat, i get a error saying "no arkose token found in .har file" while i used a .har file. How do i fix it?

Screenshots
image

Environment
Python version: 3.12.1
Location: France

@Baldi89989 Baldi89989 added the bug Something isn't working label Jun 30, 2024
@phamxtien
Copy link

I got the same

1 similar comment
@Lorodn4x
Copy link

Lorodn4x commented Jul 1, 2024

I got the same

@gamelist1990
Copy link
Contributor

I just tried it and it works fine.

@gamelist1990
Copy link
Contributor

Obtaining the HAR file from ChatGPT

Here's a method to obtain the HAR (HTTP Archive) file from ChatGPT:

  1. Access ChatGPT: Go to https://chatgpt.com/.
  2. Open Network Tab: Open your browser's developer tools and navigate to the "Network" tab.
  3. Send a Request: Interact with the AI by sending a message. Ensure you see a response in the Network tab, indicating a successful request.
  4. Open New Chat: Click on "New Chat" to start a fresh conversation.
  5. Check Request Count: Observe the request count in the Network tab. If successful, the count should be approximately between 93 and 104.

At this point, you can right-click on any of the requests and select "Save as HAR" to download the HAR file.

Note: The exact request count may vary slightly depending on the specific interaction and browser used.

@Lorodn4x
Copy link

Lorodn4x commented Jul 2, 2024

Obtaining the HAR file from ChatGPT

Here's a method to obtain the HAR (HTTP Archive) file from ChatGPT:

  1. Access ChatGPT: Go to https://chatgpt.com/.
  2. Open Network Tab: Open your browser's developer tools and navigate to the "Network" tab.
  3. Send a Request: Interact with the AI by sending a message. Ensure you see a response in the Network tab, indicating a successful request.
  4. Open New Chat: Click on "New Chat" to start a fresh conversation.
  5. Check Request Count: Observe the request count in the Network tab. If successful, the count should be approximately between 93 and 104.

At this point, you can right-click on any of the requests and select "Save as HAR" to download the HAR file.

Note: The exact request count may vary slightly depending on the specific interaction and browser used.

where should I put this file?

@gamelist1990
Copy link
Contributor


from g4f.client import Client

cookies_dir = os.path.join(os.path.dirname(__file__), "har_and_cookies")

client=Client(api_key=read_cookie_files(cookies_dir))

response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": "Hello"}],
   
)
print(response.choices[0].message.content)

In the case of a code like this, just put the har in the "har_and_cookies" folder

@Baldi89989
Copy link
Author

Is there rate limits? (Because i’m recreating clyde in discord and users spam my bot)

@GlitchOwl
Copy link

GlitchOwl commented Jul 4, 2024

Same problem. Able to get 2 answers from gpt before getting this error. I have a free account.

Found this in my har file:

f={[c.PT.PAID]:"35536E1E-65B4-4D96-9D97-6ADB7EFF8147",[c.PT.FREEACCOUNT]:"3D86FBBA-9D22-402A-B512-3420086BA6CC",[c.PT.NOAUTH]:"BD7D7B66-1476-42B2-A6BE-095F3BB4DF2D",[d.SUBSCRIPTION]:"8E3CED7F-F5EA-43D0-A5C3-745D29FDCFBC"};

However in har_file.py:

arkPreURL = "https://tcr9i.chat.openai.com/fc/gt2/public_key/35536E1E-65B4-4D96-9D97-6ADB7EFF8147"

Tried replacing 35536E1E-65B4-4D96-9D97-6ADB7EFF8147 with 3D86FBBA-9D22-402A-B512-3420086BA6CC, now it parses correctly, but i had to comment lines 118 and 119 in order for it to work.

I think it solves the problem? Now i get mostly Cloudflare errors. Sometimes i get "Our systems have detected unusual activity coming from your system. Please try again later." error. Is it related?

Note: i use a proxy

Actions i made while recording har file:

  1. visited https://chatgpt.com
  2. logged out
  3. logged in
  4. sent a request to chatgpt
  5. waited for response
  6. clicked on "new chat"
  7. sent a request again
  8. solved captcha
  9. stopped recording

@GlitchOwl
Copy link

Looks like "Our systems have detected unusual activity coming from your system. Please try again later." is related to this issue.
Arkose token is probably wrong. Im getting good responses when arkose token is not required, but i think it fails every time chatgpt needs one.
There is a chance that OpenAI have changed something again. Can anyone confirm?

@gamelist1990 are u sure u r actually using arkose tokens? g4f.debug.logging = True to check
If so, u probably have a Plus account. Can u try the same script with a free plan account?

@gamelist1990
Copy link
Contributor

Sorry, I haven't used OpenAIChat for a while, so I don't know how it works at the moment.

@gamelist1990
Copy link
Contributor

gamelist1990 commented Jul 5, 2024

ChatGPT Reverse Engineering Update: Adapting to Arkose Detection Changes

These instructions correspond to recent changes in the ChatGPT backend.

Problem:

Previously, the code relied on checking the requirements["arkose"]["required"] flag to determine if an Arkose token was necessary. However, ChatGPT has adjusted its API, and this information is now nested within a text key within the requirements object. This change breaks the existing Arkose detection logic.

Solution:

This modification the create_async_generator function to correctly interpret the updated Arkose detection mechanism.

Here's how the code is updated:

Original code:

                   as response:
                    cls._update_request_args(session)
                    await raise_for_status(response)
                    requirements = await response.json()
                    need_arkose = requirements.get("arkose", {}).get("required")
                    chat_token = requirements["token"]      

Updated code:

                    as response:
                    cls._update_request_args(session)
                    await raise_for_status(response)
                    requirements = await response.json()
                    #Get from text
                    text_data = json.loads(requirements.get("text", "{}")) 
                    need_arkose = text_data.get("turnstile", {}).get("required", False)
                    if need_arkose:
                        arkose_token = text_data.get("turnstile", {}).get("dx")
                    else:
                        need_arkose = requirements.get("arkose", {}).get("required", False) 
                    chat_token = requirements["token"]

Instead of directly accessing requirements["arkose"], the updated code:

  1. Retrieves the data from the text key and parses it as JSON.
  2. Checks for the presence of the turnstile key within the parsed JSON.
  3. If turnstile exists, it further checks if the required flag is set to True.
  4. If the required flag is True, the Arkose token is extracted from the dx key within turnstile.
  5. For backward compatibility, it also checks the old arkose key in case it's still present.

This change ensures that the code can adapt to both the old and new API responses, allowing it to accurately detect Arkose challenges and proceed with the authentication process.

@gamelist1990
Copy link
Contributor

I hope this fix helps

@gamelist1990
Copy link
Contributor

Is there rate limits? (Because i’m recreating clyde in discord and users spam my bot)

There is a possibility of rate limiting, but I think it is unlikely

@phamxtien
Copy link

today i got Response 403: Cloudflare detected

@gamelist1990
Copy link
Contributor

gamelist1990 commented Jul 7, 2024

Is it the same no matter how many times you do it?

@phamxtien

@gamelist1990
Copy link
Contributor

gamelist1990 commented Jul 7, 2024


Using OpenaiChat provider and auto model

Arkose: False Proofofwork: gAAAAABWzI1M...
INFO:    192.168.128:0 - "GET /chat?provider=OpenAI&prompt=%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF&system=&token=AI74bf652f-7de6-43eb-a592-42c5ff233d52 HTTP/1.1" 200 OK 

It's working normally in the log of my environment If you are blocked many times, please recreate the har file.

@phamxtien
Copy link

phamxtien commented Jul 7, 2024

Is it the same no matter how many times you do it?

@phamxtien

I think it causes by the network, now it runs smooth with another network.

@gamelist1990
Copy link
Contributor

let's see how it goes for a bit and let me know if there's anything else.

@GlitchOwl
Copy link

@gamelist1990 nice fix!!!
But the "No arkose token found in .har file" error still occurs.

If you change arkPreURL like i did in the message before, you get this

05:47:40
Using OpenaiChat provider and gpt-3.5-turbo model
Arkose: 53817e0ba123... Proofofwork: gAAAAABwQ8Lk...
Retry: Error 403: {"detail":"Unusual activity has been detected from your device. Try again later. (8a0d3b09afe09e04-EWR)"}
Arkose: 53817e0ba123... Proofofwork: gAAAAABwQ8Lk...
Retry: Error 403: {"detail":"Unusual activity has been detected from your device. Try again later. (8a0d3b7f68919e04-EWR)"}
Arkose: False Proofofwork: gAAAAABWzI0M...
*prints response* - finally! 

It looks like arkose check fails every time. You can see that i get a response only when "Arkose: False". Can anyone confirm? If the issue is hard to reproduce, try using a proxy

Is "Error 403: Unusual activity has been detected from your device" error related to arkose? Note: "Response 403: Cloudflare detected" is the other error and is not related to this issue.
Is arkose token required for gpt3.5?

I guess we have to figure out why openai detects unusual activity and also fix the way script parses the har file.

@gamelist1990
Copy link
Contributor

gamelist1990 commented Jul 10, 2024

#2092

As mentioned here, the API may have changed.

@GlitchOwl

@gamelist1990
Copy link
Contributor

By the way, I tried to fix that just now, but it failed spectacularly (^^)

@gamelist1990
Copy link
Contributor

It looks like arkose check fails every time. You can see that i get a response only when "Arkose: False". Can anyone confirm? If the issue is hard to reproduce, try using a proxy

Is "Error 403: Unusual activity has been detected from your device" error related to arkose? Note: "Response 403: Cloudflare detected" is the other error and is not related to this issue.
Is arkose token required for gpt3.5?

I guess we have to figure out why openai detects unusual activity and also fix the way script parses the har file.

I think this kind of thing is happening a lot because OpenAI updated and no longer uses Arkose.

@phamxtien
Copy link

I get .har from Edge Browser >> It runs ok
But with .har from Firefox >> It returns 403

Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Jul 18, 2024
@iG8R
Copy link

iG8R commented Jul 18, 2024

up

@github-actions github-actions bot removed the stale label Jul 19, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Jul 27, 2024
@iG8R
Copy link

iG8R commented Jul 27, 2024

up

@github-actions github-actions bot removed the stale label Jul 30, 2024
Copy link

github-actions bot commented Aug 6, 2024

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Aug 6, 2024
@iG8R
Copy link

iG8R commented Aug 6, 2024

up

@github-actions github-actions bot removed the stale label Aug 7, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Aug 14, 2024
@iG8R
Copy link

iG8R commented Aug 14, 2024

up

@github-actions github-actions bot removed the stale label Aug 15, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Aug 22, 2024
@iG8R
Copy link

iG8R commented Aug 22, 2024

up

@github-actions github-actions bot removed the stale label Aug 23, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Aug 31, 2024
@AppSolves
Copy link

@gamelist1990 How is it going? #2105

@gamelist1990
Copy link
Contributor

I'm sorry, I completely forgot

@gamelist1990
Copy link
Contributor

I'll take a look when I can this week

@phamxtien
Copy link

It runs smooth for me

@github-actions github-actions bot removed the stale label Sep 3, 2024
Copy link

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

@github-actions github-actions bot added the stale label Sep 10, 2024
Copy link

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

8 participants