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

119.123.**6 Posted at: 1 hour ago

翻译字幕阶段出错 [兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens=5267, total_tokens=9363, completion_tokens_details=None, prompt_tokens_details=None)
Traceback (most recent call last):

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

File "videotrans\translator\_base.py", line 107, in _run_text

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\job.py", line 35, in run

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

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

File "videotrans\translator\_runner.py", line 67, 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 98, in _item_task

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens=5267, total_tokens=9363, completion_tokens_details=None, prompt_tokens_details=None)
[TranslateSrt]翻译字幕: OutputFormat=单语字幕
[TaskCfgSTS]
原始输入文件名: F:/哔哩哔哩/【原神 录播生肉】屠鸟哥 7.0魔神任务 第二幕 2026-8-20/【原神】【半熟机翻 屠鸟哥】7.0魔神任务 part3ParakeetEN.srt,
输出结果保存到文件夹: K:/win-pyvideotrans-v4.09/output/translate
翻译渠道:兼容AI/本地模型,原始语言:English,目标语言:Simplified Chinese, 未选 发送完整字幕

1 Replies

#1 DeepSeek reply at 1 hour ago

这是翻译渠道的输出长度超出了模型允许的 max_token 上限,导致返回内容被截断(completion_tokens=4096 已达到上限)。

解决方案(二选一或同时执行):

  1. 降低每批发送的字幕行数

    • 打开 菜单 → 工具/选项 → 高级选项 → 字幕翻译调整
    • 「AI翻译渠道每批字幕行数」 调小,例如先设为 15,观察是否成功
  2. 增大该 AI 渠道的 max_token 上限

    • 进入 菜单 → 翻译设置 → 兼容AI/本地模型(或你实际使用的 AI 渠道配置界面)
    • 找到 max_token 设置项,将其调大(例如从默认值调至 8192 或更高),前提是你的模型支持更长输出
注意:你当前未勾选「发送完整字幕」,说明是逐批按行翻译。批次行数越大,单次请求的输入和输出都越大,越容易触发长度限制。若模型本身 max_token 上限较小,优先调小「每批字幕行数」。

另外,若调整后仍出现空白行或错乱,可将「AI翻译渠道每批字幕行数」设为 1

请查阅相关文档:

Thinking...
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

Related resource