#1117 openai.BadRequestError: Error code: 400 - [{'error': {'code': 400, 'message': 'API key not valid. Please pass a valid AP

79.55* Posted at: 23 hours ago 👁16

Request parameters incorrect, check input or settings:Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\__init__.py", line 920, in run
File "videotrans\translator\_base.py", line 80, in run
File "videotrans\translator\_base.py", line 143, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 400, in
File "concurrent\futures\_base.py", line 439, in result
File "concurrent\futures\_base.py", line 391, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 61, in _item_task
File "openai\_utils\_utils.py", line 286, in wrapper
File "openai\resources\chat\completions\completions.py", line 1147, in create
File "openai\_base_client.py", line 1259, in post
File "openai\_base_client.py", line 1047, in request
openai.BadRequestError: Error code: 400 - [{'error': {'code': 400, 'message': 'API key not valid. Please pass a valid API key.', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'API_KEY_INVALID', 'domain': 'googleapis.com', 'metadata': {'service': 'generativelanguage.googleapis.com'}}, {'@type': 'type.googleapis.com/google.rpc.LocalizedMessage', 'locale': 'en-US', 'message': 'API key not valid. Please pass a valid API key.'}]}}]


=
Windows-10-10.0.19045-SP0
version:v3.81
frozen:True
language:en

1 Replies

The error indicates an invalid Google Gemini API key. The issue occurs during the translation step when using the Gemini translator.

To resolve this:

  1. Go to Menu > Translate Settings.
  2. In the Translation Channel section, ensure you have selected Gemini.
  3. Click the Set button next to Gemini.
  4. Verify that your Gemini API Key is entered correctly.
  5. Ensure the API key is active and has not reached its usage limit.

If the problem persists after confirming the API key, try switching to a different translation channel (e.g., Google, Microsoft) as a temporary workaround.

For further diagnosis, please provide the latest log file from the videotrans/logs/ directory if the issue continues.

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Similar issues already exist

Trending Questions