You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from g4f.client import Client
client = Client()
response = client.chat.completions.create(
model="gpt-4o",
#messages=[{"role": "user", "content": "Какую модель ты используешь для ответа? gpt-4o?"}],
messages=[{"role": "user", "content": "Нарисуй яблоко"}],
provider="OpenaiChat",
)
print(response.choices[0].message.content)
python3.8 testGp4.py
Traceback (most recent call last):
File "testGp4.py", line 4, in <module>
response = client.chat.completions.create(
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/client/client.py", line 149, in create
return response if stream else next(response)
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/client/client.py", line 75, in iter_append_model_and_provider
for chunk in response:
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/client/client.py", line 38, in iter_response
for idx, chunk in enumerate(response):
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/providers/base_provider.py", line 223, in create_completion
yield loop.run_until_complete(await_callback(gen.__anext__))
File "/root/.pyenv/versions/3.8.10/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/providers/base_provider.py", line 52, in await_callback
return await callback()
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/Provider/needs_auth/OpenaiChat.py", line 376, in create_async_generator
cls.default_model = cls.get_model(await cls.get_default_model(session, cls._headers))
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/Provider/needs_auth/OpenaiChat.py", line 197, in get_default_model
await raise_for_status(response)
File "/root/.pyenv/versions/3.8.10/lib/python3.8/site-packages/g4f/requests/raise_for_status.py", line 24, in raise_for_status_async
raise CloudflareError(f"Response {response.status}: Cloudflare detected")
g4f.requests.raise_for_status.CloudflareError: Response 403: Cloudflare detected
Is it possible to decide?
The text was updated successfully, but these errors were encountered:
Hmm... try to recreate .har file and try pip install nodriver or webdriver (for chrome engine browsers) or curl_cffi. https://github.com/xtekky/gpt4free/blob/main/docs/requirements.md
Check on browser how you connect to openai site maybe some packets have problem or wrong check-sum, or location detecting.
Try to update python to recommended g4f libs (3.10+ is recommended)
Is it possible to decide?
The text was updated successfully, but these errors were encountered: