#2079 videotrans.configure._except.StopRetry: API key not valid. Please pass a valid API key.

45.125* Posted at: 6 hours ago 👁10

API key not valid. Please pass a valid API key.:Traceback (most recent call last):
File "videotrans\translator\_gemini.py", line 111, in _item_task
File "google\genai\models.py", line 5783, in generate_content_stream
File "google\genai\models.py", line 4666, in _generate_content_stream
File "google\genai\_api_client.py", line 774, in request_streamed
File "google\genai\_api_client.py", line 672, in _request
File "google\genai\errors.py", line 101, in raise_for_response
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'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.'}]}}

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 932, in run
File "videotrans\translator\_base.py", line 78, in run
File "videotrans\translator\_base.py", line 137, 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 131, in _item_task
videotrans.configure._except.StopRetry: API key not valid. Please pass a valid API key.


=
system:Windows-10-10.0.22631-SP0
version:v3.90
frozen:True
language:zh
root_dir:D:/AIkoux/AI/win-pyvideotrans-3.90

1 Replies

错误信息明确显示您的 Gemini API Key 无效。请按以下步骤检查和解决:

  1. 检查并重新获取 API Key:

    • 前往 Google AI Studio 登录您的 Google 账户。
    • 确保您创建的是 Gemini API 的密钥,而不是其他 Google Cloud 服务的密钥。
    • 点击“创建 API 密钥”,复制新生成的密钥。
  2. 在软件中正确配置:

    • 在 pyVideoTrans 主界面,点击右上角菜单栏的 “设置”
    • 在“翻译设置”选项卡下,找到 “Gemini” 渠道。
    • 将新复制的 API Key 粘贴到对应的输入框中。
    • 重要: 确保您选择的“翻译渠道”就是 “Gemini”。如果您在第三行翻译设置的下拉菜单中选择了其他渠道(如Google、ChatGPT等),但 Gemini 的 Key 配置有误,软件不会使用 Gemini,因此不会报此错误。此错误表明您当前确实选中了 Gemini 作为翻译渠道。
  3. 验证与测试:

    • 配置完成后,可以尝试使用软件工具箱中的 “SRT字幕文件翻译” 功能,选择一个简短的 SRT 文件进行测试,看是否还会报错。

如果问题依旧,请确认您的网络环境可以正常访问 Google 服务(部分地区可能需要代理)。如果已使用代理,请在软件主界面第五行的“网络代理”处正确填写代理地址(例如:http://127.0.0.1:7890)。

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

Trending Questions