#7145 Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=1160, prompt_tokens

89.167**5 Posted at: 2 hours ago

Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=1160, prompt_tokens=1160, total_tokens=2320, completion_tokens_details=None, prompt_tokens_details=None):Traceback (most recent call last):
File "videotrans\translator\_base.py", line 70, in run
File "videotrans\translator\_base.py", line 153, 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\util\TestSrtTrans.py", line 19, in run
File "videotrans\translator\_runner.py", line 67, in run
File "videotrans\translator\_base.py", line 73, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_openaicompat.py", line 104, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=1160, prompt_tokens=1160, total_tokens=2320, completion_tokens_details=None, prompt_tokens_details=None)


=
system:Windows-10-10.0.26200-SP0
version:v4.12
frozen:True
language:zh_CN
root_dir:C:/Users/kjncy/Downloads/win-pyvideotrans-v4.12-0908

1 Replies

#1 DeepSeek reply at 2 hours ago

这是 AI 模型翻译时输出达到最大 token 限制(max_tokens)导致回复被截断,软件无法解析完整内容。

解决方案(按优先级调整):

  1. 调小单批字幕行数
    进入 菜单 -> 工具 -> 高级选项 -> 字幕翻译调整,将 AI翻译渠道每批字幕行数 从 100 调小至 20 或更小(比如 10),降低单次请求的输出量。
  2. 取消"发送完整字幕"
    在高级选项中,取消勾选 发送完整字幕,强制使用逐行提交翻译模式。
  3. 关闭"AI翻译附带所有字幕做参考"
    你的版本是 v4.12-0908,该版本新增了 AI翻译附带所有字幕做参考 功能。此功能会把全部原文塞进上下文,极容易导致输出超限。
    位置:菜单 -> 工具 -> 高级选项 -> 字幕翻译取消勾选该项。
  4. 关闭思考模式(如果是 DeepSeek 等)
    DeepSeek 的思考模式(Thinking)会先消耗大量 token,极易导致实际输出被截断。
    位置:菜单 -> 翻译设置 -> DeepSeek取消勾选 Thinking 复选框
  5. 增大 max_tokens
    如果渠道允许自定义 max_tokens,将其调大至 8192 或更高。部分 API 有硬性上限,请以模型文档为准。
  6. 更换更强模型
    若持续报错,建议改用 DeepSeek-V3 或 GPT-4o 等旗舰模型,它们的输出上限更高、指令跟随能力更强。

推荐配置:

  • AI 翻译渠道:DeepSeek-V3OpenAI GPT-4o
  • 每批字幕行数:20
  • 发送完整字幕:关闭
  • AI翻译附带所有字幕做参考:关闭
  • Thinking 模式:关闭

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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