#4559 videotrans.configure._except.StopRetry: API Key not found. Please pass a valid API key.

2a09:bac1* Posted at: 2 hours ago 👁7

API Key not found. Please pass a valid API key.:Traceback (most recent call last):
File "videotrans\translator\_gemini.py", line 103, in _item_task
File "google\genai\models.py", line 5407, in generate_content_stream
File "google\genai\models.py", line 4101, in _generate_content_stream
File "google\genai\_api_client.py", line 1405, in request_streamed
File "google\genai\_api_client.py", line 1224, in _request
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 420, in exc_check
File "tenacity\__init__.py", line 187, in reraise
File "concurrent\futures\_base.py", line 451, in result
File "concurrent\futures\_base.py", line 403, in __get_result
File "tenacity\__init__.py", line 480, in call
File "google\genai\_api_client.py", line 1189, in _request_once
File "google\genai\errors.py", line 121, in raise_for_response
File "google\genai\errors.py", line 146, in raise_error
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'API Key not found. 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 found. Please pass a valid API key.'}]}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\__init__.py", line 1057, in run
File "videotrans\translator\_base.py", line 97, in run
File "videotrans\translator\_base.py", line 161, 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 451, in result
File "concurrent\futures\_base.py", line 403, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_gemini.py", line 123, in _item_task
videotrans.configure._except.StopRetry: API Key not found. Please pass a valid API key.


=
system:Windows-10-10.0.26200-SP0
version:v3.99
frozen:True
language:en
root_dir:D:/win-pyvideotrans-v3.99-0508 (2)

1 Replies

This error means the Gemini API key you provided is invalid or missing. The software cannot authenticate with Google's service.

Solution:

  1. Open the software menu: 菜单翻译设置Gemini (or the AI translation settings for Gemini).
  2. Enter a valid Gemini API key in the corresponding field. You can obtain a free key at ai.google.dev.
  3. Make sure there are no trailing spaces or extra characters in the key field.
  4. Click Save and restart the translation task.

If you are behind a firewall or in a region where Google services are blocked, you may also need to configure a proxy in the main interface (the "Network Proxy" field).

Reference Documentation:

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.

Related resource