gpt4free icon indicating copy to clipboard operation
gpt4free copied to clipboard

Error GPT 3.5 turbo Response 401: {"detail":"Unauthorized"}

Open BokDan93 opened this issue 1 year ago • 15 comments

I added it yesterday .HAR File to the folder ./harder, the model is working, today the error Response 401: {"detail":"Unauthorized"} What to do? Do I need to add a file every time? Is it possible to do as before and not use this file?

BokDan93 avatar Apr 09 '24 09:04 BokDan93

You could install and use nodriver. It performs the same function as the previous webdriver.

hlohaus avatar Apr 09 '24 23:04 hlohaus

Could you please tell me how to do this or provide a link to the tutorial?

BokDan93 avatar Apr 10 '24 06:04 BokDan93

The installation of Nodriver can be achieved through the following command:

pip install -U nodriver

No further configuration is required.

hlohaus avatar Apr 10 '24 08:04 hlohaus

Please, could you elaborate how to use nodriver to make WebUI start working instead of bringing up:

Using OpenaiChat provider and gpt-3.5-turbo model
ERROR:root:Response 401: {"detail":"Could not parse your authentication token. Please try signing in again."}
Traceback (most recent call last):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\gui\server\api.py", line 125, in _create_response_stream
    for chunk in ChatCompletion.create(**kwargs):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 208, in create_completion
    yield loop.run_until_complete(await_callback(gen.__anext__))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 40, in await_callback
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 381, in create_async_generator
    await raise_for_status(response)
  File "c:\gpt4free\venv\Lib\site-packages\g4f\requests\raise_for_status.py", line 28, in raise_for_status_async
    raise ResponseStatusError(f"Response {response.status}: {message}")
g4f.errors.ResponseStatusError: Response 401: {"detail":"Could not parse your authentication token. Please try signing in again."}
127.0.0.1 - - [10/Apr/2024 15:03:45] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [10/Apr/2024 15:03:45] "POST /backend-api/v2/conversation HTTP/1.1" 200 -

iG8R avatar Apr 10 '24 12:04 iG8R

Thanks, I'll try!

Could you reflect this point somewhere in the tutorials, at least where we are talking about the .har file? Thank you in advance

BokDan93 avatar Apr 10 '24 12:04 BokDan93

PS. Forgot to mention that even with nodriver installed, the aforementioned error still occurs.

iG8R avatar Apr 10 '24 14:04 iG8R

I have resolved the authentication token parsing issue in the GUI.

Nodriver should now automatically open a browser window.

hlohaus avatar Apr 10 '24 14:04 hlohaus

Now (0.2.9.3 version) it starts work fine with the presence of the har file, but without it only arises the following error:

Using OpenaiChat provider and gpt-3.5-turbo model
127.0.0.1 - - [10/Apr/2024 18:24:50] "GET /static/img/user.png HTTP/1.1" 200 -
ERROR:root:
Traceback (most recent call last):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\gui\server\api.py", line 125, in _create_response_stream
    for chunk in ChatCompletion.create(**kwargs):
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 211, in create_completion
    yield loop.run_until_complete(await_callback(gen.__anext__))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\providers\base_provider.py", line 40, in await_callback
    return await callback()
           ^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 371, in create_async_generator
    await cls.nodriver_access_token()
  File "c:\gpt4free\venv\Lib\site-packages\g4f\Provider\needs_auth\OpenaiChat.py", line 584, in nodriver_access_token
    browser = await uc.start(user_data_dir=user_data_dir)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\util.py", line 74, in start
    return await Browser.create(config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\browser.py", line 87, in create
    await instance.start()
  File "c:\gpt4free\venv\Lib\site-packages\nodriver\core\browser.py", line 312, in start
    await asyncio.create_subprocess_exec(
  File "C:\Python312\Lib\asyncio\subprocess.py", line 222, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 1708, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 502, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError
127.0.0.1 - - [10/Apr/2024 18:24:51] "POST /backend-api/v2/conversation HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [10/Apr/2024 18:24:51] "POST /backend-api/v2/conversation HTTP/1.1" 200 -

iG8R avatar Apr 10 '24 15:04 iG8R

Error after installation pip install -U nodriver: list index out of range

BokDan93 avatar Apr 11 '24 13:04 BokDan93

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[bot] avatar Apr 19 '24 00:04 github-actions[bot]

Do you still have this error?

hlohaus avatar Apr 23 '24 04:04 hlohaus

yes( Uploading 2024-04-29_21h14_17.jpg…

BokDan93 avatar Apr 29 '24 18:04 BokDan93

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[bot] avatar May 13 '24 00:05 github-actions[bot]

The validity period of an OpenAI Chat .har file is limited to one day.

hlohaus avatar May 19 '24 03:05 hlohaus

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[bot] avatar May 27 '24 00:05 github-actions[bot]

Closing due to inactivity.

github-actions[bot] avatar Jul 06 '24 00:07 github-actions[bot]