#7098 Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=65536, prompt_token

95.41**8 Posted at: 2 hours ago

Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=65536, prompt_tokens=3175, total_tokens=68711, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1024), prompt_cache_hit_tokens=1024, prompt_cache_miss_tokens=2151)
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 71, in run
File "videotrans\translator\_base.py", line 154, 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 89, in run
File "videotrans\task\_stage_translate.py", line 31, 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 107, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=65536, prompt_tokens=3175, total_tokens=68711, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1024), prompt_cache_hit_tokens=1024, prompt_cache_miss_tokens=2151)

cfg=[TaskCfgVTT]当前工作模式: 翻译视频 单视频模式
原始输入文件名: C:/Users/共产主义者/Downloads/初稿/用于字幕提取.mp4,
输出结果保存到文件夹: C:/Users/共产主义者/Downloads/用于字幕提取-mp4,
临时文件夹: D:/BaiduNetdiskDownload/win-pyvideotrans-v4.12/tmp/10788/998d4dfc67
已选 清理已存在
未启用CUDA加速
未选 降噪
语音识别:openai-whisper(内置), small, 发音语言: 泰国语, 断句方式:默认断句
翻译渠道:DeepSeek,原始语言:泰国语,目标语言:简体中文, 已选 发送完整字幕
未选 配音角色,不进行配音
字幕: 嵌入硬字幕
代理地址:http://127.0.0.1:7897


=
system:Windows-10-10.0.19045-SP0
version:v4.12
frozen:True
language:zh_CN
root_dir:D:/BaiduNetdiskDownload/win-pyvideotrans-v4.12

1 Replies

#1 DeepSeek reply at 2 hours ago

报错原因是:DeepSeek 翻译时输出了 65536 个 token,达到了模型或设置的最大长度限制,导致返回内容被截断,无法解析为正常字幕。这说明你当前一次性提交给 AI 翻译的字幕量过大,或者 AI 渠道的 max token 设置过小。

解决方案(任选其一或组合使用):

  1. 减小每次提交给 AI 翻译的字幕行数
    进入 菜单 -> 工具/选项 -> 高级选项 -> 字幕翻译调整,将 AI翻译渠道每批字幕行数 调小,例如设为 2050,不要一次性发送全部字幕。
  2. 取消勾选“AI一次性翻译所有字幕行”
    在同一个高级选项面板中,取消勾选 AI翻译一次性翻译所有字幕行,改为分批翻译。
  3. 增大 DeepSeek 渠道的 max token 设置
    进入 菜单 -> 翻译设置 -> DeepSeek,找到 max token 或最大输出 token 参数,将其调大(例如设为 8192 或更大)。注意:如果当前模型本身最大输出只有 65536,则需配合缩小批次。
  4. 取消勾选“发送完整字幕”
    在主界面翻译渠道附近,取消勾选 发送完整字幕,改为按行纯文本提交,可显著降低单次请求的 token 量。
  5. 精简视频字幕量
    如果源字幕本身非常长,可先使用语音转录功能生成字幕后人工精简,或分段处理。

执行以上任意一项后重新尝试翻译即可。

请查阅相关文档:

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