#1120 videotrans.configure._except.StopRetry: The thinking budget 1 is invalid. Please choose a value between 128 and 32768.

194.156* Posted at: 1 month ago 👁130

翻译字幕阶段出错:[Gemini AI] The thinking budget 1 is invalid. Please choose a value between 128 and 32768. :
Traceback (most recent call last):
File "videotrans\translator\_gemini.py", line 103, 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': 'The thinking budget 1 is invalid. Please choose a value between 128 and 32768.', 'status': 'INVALID_ARGUMENT'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\job.py", line 146, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
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 123, in _item_task
videotrans.configure._except.StopRetry: The thinking budget 1 is invalid. Please choose a value between 128 and 32768.


=
system:Windows-10-10.0.22631-SP0
version:v3.82
frozen:True
language:zh
root_dir:F:/win-videotrans-v3.82/win-videotrans-v3.82_20251019_125144

5 Replies

这个错误是因为 Gemini AI 翻译渠道的 "思考预算" 参数设置不正确。错误信息显示您设置的值为 1,但有效范围应在 128 到 32768 之间。

请按以下步骤修正:

  1. 在软件主界面,点击菜单栏的 翻译设置
  2. 在翻译设置窗口中,找到 Gemini AI 相关的配置项
  3. 将 "思考预算" 参数修改为 128 到 32768 之间的一个值(建议从 512 或 1024 开始尝试)
  4. 保存设置后重新运行翻译任务

如果设置界面中没有找到该选项,请检查您的 API 密钥配置是否正确,或者尝试重新配置 Gemini AI 翻译渠道。

求助,这个问题有谁知道怎么解决吗?Gemini AI的翻译设置里没有“思考预算”的选项。重新配置API也不好使。

这个问题是因为软件内部传递给 Gemini API 的参数超出了有效范围。虽然界面上没有"思考预算"的配置项,但可以通过以下方法解决:

  1. 临时解决方案:切换到其他翻译渠道,如 Google、Microsoft 或 OpenAI 等,完成当前任务。
  2. 根本解决方案

    • 在软件根目录找到并打开 videotrans/cfg.json 文件
    • 查找与 Gemini 相关的配置项,特别是 thinking_budget 或类似参数
    • 将其值修改为 128 到 32768 之间的数值(建议 512 或 1024)
    • 保存文件后重启软件

如果 cfg.json 中没有相关配置,这可能是软件版本的一个 bug。建议:

  • 检查是否有软件更新版本
  • 在 GitHub 项目页面提交 issue 报告此问题
  • 暂时使用其他翻译渠道替代

同时,您也可以在"高级选项"中尝试将"同时翻译的字幕数"设为 1,看看是否能绕过此问题。

ctg.json文档内容:
{"homedir": "E:/Doc/pyvideo", "lang": "", "Faster_Whisper_XXL": "", "crf": 25, "cuda_decode": false, "preset": "slow", "ffmpeg_cmd": "", "aisendsrt": true, "dont_notify": false, "video_codec": 264, "ai302_models": "gpt-4o-mini,gpt-4o,qwen-max,glm-4,yi-large,deepseek-chat,doubao-pro-128k,gemini-2.0-flash", "qwenmt_model": "qwen-mt-turbo,qwen-mt-plus,qwen3-asr-flash,qwen-plus,qwen-turbo,qwen-plus-latest,qwen-turbo-latest", "openaitts_model": "tts-1,tts-1-hd,gpt-4o-mini-tts", "openairecognapi_model": "whisper-1,gpt-4o-transcribe,gpt-4o-mini-transcribe", "chatgpt_model": "gpt-4o-mini,gpt-4o,gpt-4,gpt-4-turbo,gpt-4.5-preview-2025-02-27,o1,o1-pro,o3-mini,moonshot-v1-8k,deepseek-chat,deepseek-reasoner", "claude_model": "claude-3-5-sonnet-latest,claude-3-7-sonnet-latest,claude-3-5-haiku-latest", "azure_model": "gpt-4o,gpt-4o-mini,gpt-4,gpt-4.5-preview,o3-mini,o1,o1-mini", "localllm_model": "qwen:7b,moonshot-v1-8k,deepseek-chat", "zhipuai_model": "glm-4-flash", "deepseek_model": "deepseek-chat,deepseek-reasoner", "openrouter_model": "moonshotai/kimi-k2:free,tngtech/deepseek-r1t2-chimera:free,deepseek/deepseek-r1-0528:free", "guiji_model": "Qwen/Qwen3-8B,Qwen/Qwen2.5-7B-Instruct,Qwen/Qwen2-7B-Instruct", "zijiehuoshan_model": "", "model_list": "tiny,tiny.en,base,base.en,small,small.en,medium,medium.en,large-v1,large-v2,large-v3,large-v3-turbo,distil-small.en,distil-medium.en,distil-large-v2,distil-large-v3", "remove_silence": true, "vad": true, "threshold": 0.5, "min_speech_duration_ms": 1000, "max_speech_duration_s": 15, "min_silence_duration_ms": 250, "speech_pad_ms": 200, "rephrase": false, "rephrase_local": false, "voice_silence": 200, "interval_split": 10, "bgm_split_time": 300, "trans_thread": 20, "aitrans_thread": 50, "translation_wait": 0, "dubbing_wait": 1, "dubbing_thread": 5, "save_segment_audio": false, "countdown_sec": 120, "backaudio_volume": 0.5, "separate_sec": 600, "loop_backaudio": false, "cuda_com_type": "int8_float32", "initial_prompt_zh-cn": "在每行末尾添加标点符号,在每个句子末尾添加标点符号。", "initial_prompt_zh-tw": "在每行末尾添加標點符號,在每個句子末尾添加標點符號。", "initial_prompt_en": "add punctuation at the end of each line, and punctuation at the end of each sentence.", "initial_prompt_fr": "", "initial_prompt_de": "", "initial_prompt_ja": "", "initial_prompt_ko": "", "initial_prompt_ru": "", "initial_prompt_es": "", "initial_prompt_th": "", "initial_prompt_it": "", "initial_prompt_pt": "", "initial_prompt_vi": "", "initial_prompt_ar": "", "initial_prompt_tr": "", "initial_prompt_hi": "", "initial_prompt_hu": "", "initial_prompt_uk": "", "initial_prompt_id": "", "initial_prompt_ms": "", "initial_prompt_kk": "", "initial_prompt_cs": "", "initial_prompt_pl": "", "initial_prompt_nl": "", "initial_prompt_sv": "", "initial_prompt_he": "", "initial_prompt_bn": "", "initial_prompt_fil": "", "initial_prompt_fa": "", "initial_prompt_ur": "", "initial_prompt_yue": "", "beam_size": 5, "best_of": 5, "condition_on_previous_text": false, "fontsize": 11, "fontname": "microsoft yahei ui", "fontcolor": "&h00ffff", "fontbordercolor": "&h80000000", "backgroundcolor": "&h000000", "subtitle_position": 5, "qwentts_role": "Cherry,Serena,Ethan,Chelsie,Sunny,Jada,Dylan", "qwentts_models": "qwen3-tts-flash,qwen-tts-latest,qwen-tts", "marginV": 10, "marginL": 0, "marginR": 0, "outline": 1, "shadow": 1, "borderStyle": 1, "cjk_len": 20, "other_len": 60, "gemini_model": "gemini-2.5-pro", "llm_chunk_size": 3000, "llm_ai_type": "openai", "gemini_recogn_chunk": 50, "zh_hant_s": true, "azure_lines": 100, "chattts_voice": "11,12,16,2222,4444,6653,7869,9999,5,13,14,1111,3333,4099,5099,5555,8888,6666,7777", "proxy": "http://127.0.0.1:10020"}

在您的 cfg.json 文件中没有找到"思考预算"参数,这说明该参数可能是在软件内部硬编码的。这是一个已知的软件版本兼容性问题。

解决方案:

  1. 临时解决方法: 在软件主界面的"翻译设置"中,将翻译渠道从 Gemini AI 切换到其他可用的选项,如 Google、Microsoft 或 OpenAI 等。
  2. 根本解决方法: 更新到最新版本的 pyVideoTrans。当前您使用的是 v3.82,最新版本是 v3.83,可能已经修复了这个问题。
  3. 如果必须使用 Gemini AI: 尝试在"高级选项"中调整以下设置:

    • 将"同时翻译的字幕数"设为 1
    • 取消勾选"发送完整字幕"
  4. 备选方案: 如果上述方法都无效,建议在 GitHub 项目页面提交 issue,报告这个 Gemini AI 参数配置问题。

目前最直接的解决方式就是切换到其他翻译渠道完成当前任务。

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