#3278 openai.AuthenticationError: Error code: 401 - {'error': {'message':

14.191* Posted at: 12 hours ago 👁14

API key error, please check if the key is correct Error code: 401 - {'error': {'message': "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.", 'type': 'invalid_request_error', 'param': None, 'code': None}}:
Traceback (most recent call last):
File "videotrans\util\TestSTT.py", line 17, in run
File "videotrans\recognition\__init__.py", line 233, in run
File "videotrans\recognition\_base.py", line 141, in run
File "videotrans\recognition\_openairecognapi.py", line 63, in _exec
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\audio\transcriptions.py", line 472, in create
File "openai\_base_client.py", line 1297, in post
File "openai\_base_client.py", line 1070, in request
openai.AuthenticationError: Error code: 401 - {'error': {'message': "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.", 'type': 'invalid_request_error', 'param': None, 'code': None}}


=
system:Windows-10-10.0.19045-SP0
version:v3.97
frozen:True
language:en
root_dir:C:/Users/duykq/Downloads

1 Replies

This error indicates that the OpenAI API key is missing or incorrect when using the OpenAI Speech Recognition (ASR) channel.

Solution:

  1. In the main interface, go to the "Speech Recognition" tab.
  2. Ensure "OpenAI Whisper API" is selected as the channel.
  3. Click the "Settings" button next to the channel dropdown.
  4. In the settings window, verify that the "API Key" field contains a valid OpenAI API key. The key should start with sk-.
  5. If the key is missing or incorrect, obtain a new key from https://platform.openai.com/account/api-keys and paste it into the field.
  6. Click "Save" and test the connection again.

Note: If you are using a third-party service compatible with the OpenAI API (e.g., DeepSeek, OpenRouter), ensure the correct "API URL" is also configured in the settings, and the API key corresponds to that service.

Please refer to the relevant documentation:

Post Your Reply