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

Use the G4F AsyncClient API #1972

Closed
RezaRamezanisani opened this issue May 18, 2024 · 3 comments
Closed

Use the G4F AsyncClient API #1972

RezaRamezanisani opened this issue May 18, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@RezaRamezanisani
Copy link

Do I need to get GPT chat API to use AsyncClient API?

this is my error:

Traceback (most recent call last):
  File "C:\gpt4\chat.py", line 25, in <module>
    asyncio.run(main())
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Gigabyte\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\gpt4\chat.py", line 21, in main
    responses = await asyncio.gather(task1, task2)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\gpt4\g4f\client\async_client.py", line 63, in iter_append_model_and_provider
    async for chunk in response:
  File "C:\gpt4\g4f\client\async_client.py", line 37, in iter_response
    async for chunk in response:
  File "C:\gpt4\g4f\Provider\needs_auth\OpenaiChat.py", line 381, in create_async_generator
    await raise_for_status(response)
  File "C:\gpt4\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
@RezaRamezanisani RezaRamezanisani added the bug Something isn't working label May 18, 2024
@hlohaus
Copy link
Collaborator

hlohaus commented May 18, 2024

Hey, OpenAI doesn't seem to like your IP address. You might need to set up a proxy to access it.

@RezaRamezanisani
Copy link
Author

What is the workaround? Thank

@hlohaus
Copy link
Collaborator

hlohaus commented May 19, 2024

As a potential solution, you could consider utilizing a proxy server or a virtual private network (VPN). By doing so, your IP address will be modified, potentially resolving the issue at hand.

@hlohaus hlohaus closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants