#6159 翻译字幕阶段出错 [OpenRouter] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数Could not parse response content as the length limit

203.10* Posted at: 1 hour ago

翻译字幕阶段出错 [OpenRouter] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8188, prompt_tokens=3401, total_tokens=11589, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=0, reasoning_tokens=7042, rejected_prediction_tokens=None, image_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0, cache_write_tokens=0, video_tokens=0), cost=0.0214903, is_byok=False, cost_details={'upstream_inference_cost': 0.0214903, 'upstream_inference_prompt_cost': 0.0010203, 'upstream_inference_completions_cost': 0.02047})
Traceback (most recent call last):

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

File "videotrans\translator\_base.py", line 206, 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, i
......
ne 35, in run

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

File "videotrans\task\translate_srt.py", line 47, in trans

File "videotrans\translator\_runner.py", line 63, in run

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

File "tenacity\__init__.py", line 480, in call

File "videotrans\translator\_openaicompat.py", line 92, in _item_task

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8188, prompt_tokens=3401, total_tokens=11589, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=0, reasoning_tokens=7042, rejected_prediction_tokens=None, image_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0, cache_write_tokens=0, video_tokens=0), cost=0.0214903, is_byok=False, cost_details={'upstream_inference_cost': 0.0214903, 'upstream_inference_prompt_cost': 0.0010203, 'upstream_inference_completions_cost': 0.02047})
cfg=TaskCfgSTS(uuid='932becc589', name='C:/Users/Administrator/Desktop/MDYD-402_Mika_Yamaguchi_pornolab-openAI-V2.net.srt', dirname='C:/Users/Administrator/Desktop', noextname='MDYD-402_Mika_Yamaguchi_pornolab-openAI-V2.net', basename='MDYD-402_Mika_Yamaguchi_pornolab-openAI-V2.net.srt', ext='srt', target_dir='C:/Users/Administrator/Desktop', cache_folder=None, is_cuda=False, source_language=None, source_language_code='Japanese', source_sub='C:/Users/Administrator/Desktop/MDYD-402_Mika_Yamaguchi_pornolab-openAI-V2.net.srt', source_wav=None, source_wav_output=None, target_language=None, target_language_code='Simplified Chinese', target_sub='C:/Users/Administrator/Desktop/MDYD-402_Mika_Yamaguchi_pornolab-openAI-V2.net.Simplified Chinese.srt', target_wav=None, target_wav_output=None, translate_type=10)


=
system:Windows-10-10.0.19045-SP0
version:v4.07
frozen:True
language:zh
root_dir:C:/Users/Administrator/Desktop/win-pyvideotrans-v4.07(1)

1 Replies

这是 AI 翻译模型返回的内容超过了您设置的 max_token 上限导致的。

解决方法

  1. 降低每批发送的字幕行数
    进入 菜单 → 工具/选项 → 高级选项 → 字幕翻译调整,将 AI翻译渠道每批字幕行数 从较大的数值(如 100)调低为 20~50,减小单次请求的数据量。
  2. 增大 max_token
    进入 菜单 → 翻译设置 → OpenRouter(或对应 AI 渠道的设置面板),找到 max_token 选项,将其增大至 8192 或更大值(具体取决于所用模型限制,例如模型 qwen3 支持 32K+ tokens)。

修改后重启软件,重新执行翻译任务即可。

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