summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/OpenaiChat.py
diff options
context:
space:
mode:
authorTekky <98614666+xtekky@users.noreply.github.com>2024-07-05 18:21:20 +0200
committerGitHub <noreply@github.com>2024-07-05 18:21:20 +0200
commitfea9e7a198fd21aa22c9ced90977c941c4ceffb6 (patch)
tree6a6b4c71a39076ada42d15fc8289b458cb6b52b6 /g4f/Provider/needs_auth/OpenaiChat.py
parentMerge pull request #2089 from Anurag-Varma/main (diff)
parentChatGPT Reverse Engineering Update: Adapting to Arkose Detection Changes (diff)
downloadgpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar.gz
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar.bz2
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar.lz
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar.xz
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.tar.zst
gpt4free-fea9e7a198fd21aa22c9ced90977c941c4ceffb6.zip
Diffstat (limited to 'g4f/Provider/needs_auth/OpenaiChat.py')
-rw-r--r--g4f/Provider/needs_auth/OpenaiChat.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/g4f/Provider/needs_auth/OpenaiChat.py b/g4f/Provider/needs_auth/OpenaiChat.py
index f40ae961..9321c24a 100644
--- a/g4f/Provider/needs_auth/OpenaiChat.py
+++ b/g4f/Provider/needs_auth/OpenaiChat.py
@@ -406,7 +406,12 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
cls._update_request_args(session)
await raise_for_status(response)
requirements = await response.json()
- need_arkose = requirements.get("arkose", {}).get("required")
+ 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"]
if need_arkose and arkose_token is None: