#5843 翻译字幕阶段出错 [Gemini AI] User location is not supported for the API use.Traceback (most recent call last):

45.202* Posted at: 11 hours ago

翻译字幕阶段出错 [Gemini AI] User location is not supported for the API use.
Traceback (most recent call last):

File "videotrans\translator\_gemini.py", line 89, 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 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\task\job.py", line 35, in run

File "videotrans\task\job.py", line 135, in process_task

File "videotrans\task\trans_create.py", line 608, in trans

File "videotrans\translator\__init__.py", line 860, in run

File "videotrans\translator\_base.py", line 68, in run

File "videotrans\translator\_base.py", line 142, 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 111, in _item_task

videotrans.configure.excepts.StopTask: User location is not supported for the API use.
cfg=[TaskCfgVTT]当前工作模式: 转录并翻译字幕
原始输入文件名: G:/油管/The Kulture Study- AtHeart 'Say It' MV.mkv,
输出结果保存到文件夹: G:/油管/The Kulture Study- AtHeart 'Say It' MV-mkv,
临时文件夹: E:/py/win-pyvideotrans-v4.02-0615/tmp/3196/739f75a020
未选 清理已存在
已选 启用CUDA加速
未选 降噪
语音识别:faster-whisper(本地内置), model_name: large-v3-turbo, 发音语言: 英语, 断句方式:默认断句
翻译渠道:Gemini AI,原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
输出字幕格式: 目标语言在下双字幕
代理地址:http://127.0.0.1:7897


=
system:Windows-10-10.0.26200-SP0
version:v4.03
frozen:True
language:zh
root_dir:E:/py/win-pyvideotrans-v4.02-0615

1 Replies

此错误是因为 Gemini API 不允许中国大陆地区的 IP 直接访问。你虽然设置了代理地址 http://127.0.0.1:7897,但可能代理未生效、地址格式有误或代理本身无法连通到 Google 服务。

解决方案:

  1. 确认代理有效性:在浏览器中打开 https://gemini.google.com 测试代理是否可用。如果不可用,请更换代理或 VPN。
  2. 正确填写代理格式:确保主界面 网络代理 输入框中填写为 http://127.0.0.1:7897(不带多余空格或引号)。如果代理是 socks5 协议,格式为 socks5://127.0.0.1:端口
  3. 清空后重新填写:先清空代理文本框,保存后重新输入正确的代理地址并保存,再启动任务。
  4. 更换翻译渠道:如果无法解决代理问题,建议将翻译渠道切换为国内可直连的服务,例如 DeepSeek字节火山智谱AI百度翻译(需自行申请 API Key)。

请查阅相关文档:

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.

Dondate via ko-fi.com

Dondate via PayPal

Related resource