#6283 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数Could not parse response content as the length limit was reached - Complet

2405:4800* Posted at: 7 hours ago

内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8196, prompt_tokens=1946, total_tokens=10142, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=0, reasoning_tokens=0, 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.102244, is_byok=False, cost_details={'upstream_inference_cost': 0.102244, 'upstream_inference_prompt_cost': 0.003892, 'upstream_inference_completions_cost': 0.098352})
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 71, in run
File "videotrans\translator\_base.py", line 204, 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 421, in exc_check
tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 83, in run
File "videotrans\task\_stage_translate.py", line 31, 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=8196, prompt_tokens=1946, total_tokens=10142, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=0, reasoning_tokens=0, 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.102244, is_byok=False, cost_details={'upstream_inference_cost': 0.102244, 'upstream_inference_prompt_cost': 0.003892, 'upstream_inference_completions_cost': 0.098352})

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: D:/video/tiger75815[HD]_musicaldown.com_1785698589.mp4,
输出结果保存到文件夹: D:/video/_video_out/tiger75815[HD]_musicaldown.com_1785698589-mp4,
临时文件夹: D:/pyVideoTrans/win-pyvideotrans-v4.07/tmp/6872/d9c42ec22f
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:ElevenLabs.io, model_name: , 发音语言: 越南语, 断句方式:LLM重新断句
翻译渠道:OpenRouter,原始语言:越南语,目标语言:简体中文, 已选 发送完整字幕
未选 配音角色,不进行配音
字幕: 嵌入硬字幕
已选 分离人声与背景声, 已选 重新嵌入背景声, 背景音量0.5, 背景声音时长 短于 视频时长时: 拉长(降速播放),存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:


=
system:Windows-10-10.0.22631-SP0
version:v4.08
frozen:True
language:zh
root_dir:D:/pyVideoTrans/win-pyvideotrans-v4.07

1 Replies

该报错的直接原因是:翻译渠道(OpenRouter)返回内容达到了模型的最大输出 Token 上限(日志中 completion_tokens=8196 已触顶),导致 OpenAI 兼容接口判定“输出长度被截断”,从而抛出 LengthFinishReasonError。常见于单次发送过多字幕行、勾选了“发送完整字幕”或“AI翻译一次性翻译所有字幕行”时。

请按以下步骤解决:

  1. 调大对应渠道的 max_token
    打开 菜单 → 翻译设置 → OpenRouter,在模型参数中把 max_tokens 从默认/当前值调大,例如设为 16384 或更大的值。前提是所选模型本身支持更长的输出长度。
  2. 降低每次发送的字幕行数
    打开 菜单 → 工具 → 高级选项 → 字幕翻译调整,将 AI翻译渠道每批字幕行数 从较大值改小,例如改为 2010 或更小。这会减少单次请求需要返回的内容量。
  3. 关闭“AI翻译一次性翻译所有字幕行”
    如果高级选项中勾选了该项,请取消勾选,避免一次性输出整份字幕导致超长截断。
  4. 如仍失败,可暂时取消勾选“发送完整字幕”
    对于部分模型,发送完整字幕会连同时间轴和行号一并处理,输出压力更大。取消后软件会改为逐行/分批发送文本。
  5. 重新执行时建议勾选“清理已生成”
    避免使用旧的翻译缓存导致再次失败。

请查阅相关文档:

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