#2011 videotrans.configure._except.StopRetry: User location is not supported for the API use.

23.19* Posted at: 7 hours ago 👁4

User location is not supported for the API use.: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 FAILED_PRECONDITION. {'error': {'code': 400, 'message': 'User location is not supported for the API use.', 'status': 'FAILED_PRECONDITION'}}

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: User location is not supported for the API use.


=
system:Windows-10-10.0.26100-SP0
version:v3.87
frozen:True
language:zh
root_dir:E:/ruanjian/win-pyvideotrans-v3.87

1 Replies

错误信息 "User location is not supported for the API use." 表明您当前所在的地区(中国)无法直接使用 Gemini API。

解决方案:

  1. 使用代理(推荐):在 pyVideoTrans 主界面第 5 行的 网络代理 输入框中,填入可用的代理地址(格式如 http://127.0.0.1:7890socks5://127.0.0.1:7890),然后重试。
  2. 更换翻译渠道:如果您无法使用代理,请切换到其他不受地域限制的翻译渠道,例如:

    • DeepSeek(免费,国内可用)
    • 智谱AI(国内可用)
    • 百度翻译腾讯翻译(需申请API Key)
    • 本地大模型(如配置了Ollama等)

操作步骤:

  • 在翻译设置的下拉菜单中,选择上述任一替代渠道。
  • 如果选择需要API Key的渠道,请确保已在“翻译设置”中正确填写了对应的Key。

如果问题依旧,请检查代理是否有效或确认其他渠道的API配置是否正确。

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