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

2a0c**5aa3 Posted at: 1 hour ago

Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=1085, prompt_tokens=3011, total_tokens=4096, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=0))
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 71, in run
File "videotrans\translator\_base.py", line 209, 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 105, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=1085, prompt_tokens=3011, total_tokens=4096, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=0))

cfg=[TaskCfgVTT]当前工作模式: 翻译视频 单视频模式
原始输入文件名: C:/Users/DeRMsi/Videos/VideosPrueba/1Ford Mondeo Mk: How To Remove Door Handle (Replace Door Handle).mp4,
输出结果保存到文件夹: C:/Users/DeRMsi/Videos/VideosPrueba/_video_out/1Ford Mondeo Mk: How To Remove Door Handle (Replace Door Handle)-mp4,
临时文件夹: C:/Users/DeRMsi/Videos/win-pyvideotrans-v4.11/tmp/2136/0ed734f0e4
未选 清理已存在
已启用CUDA加速
未选 降噪
STT Service:faster-whisper(Built-in), large-v3, 发音语言: English, 断句方式:默认断句
TranslateSrt:CompatibleAI/LocalModel,原始语言:English,目标语言:Spanish, 已选 SendSRT
TTS Service:ChatterBox(Built-in), 角色:varon.wav, 配音语言:Spanish, 未选 二次语音识别
音量:+0%, 语速:+0%, 未选 音频加速, 未选 视频慢速
未选 移除字幕间空隙, 未选 强制对齐字幕和声音
字幕: Hard Subtitles


=
system:Windows-10-10.0.26200-SP0
version:v4.11
frozen:True
language:en
root_dir:C:/Users/DeRMsi/Videos/win-pyvideotrans-v4.11

1 Replies

#1 DeepSeek reply at 1 hour ago

The core issue: the AI translation channel (CompatibleAI/LocalModel) hit its output length limit. The error LengthFinishReasonError / Could not parse response content as the length limit was reached means the model's response exceeded the maximum token limit (here total_tokens=4096), so the returned content was truncated and could not be parsed.

This is caused by sending too much text in a single request. Your config shows 已选 SendSRT (Send full SRT), which sends the entire subtitle block at once — combined with a low-context local model, the output easily overflows.

Fix (do in order):

  1. Menu → Tools/Options → Advanced Options → 字幕翻译 (Translation):

    • Lower AI翻译渠道每批字幕行数 (Batch size per request) to a small value, e.g. 1–5.
    • Try unchecking 发送完整字幕 (Send full SRT) to switch to line-by-line translation.
    • Uncheck AI翻译附带所有字幕做参考 if it is enabled.
  2. Raise the model's max output tokens:

    • If using CompatibleAI/LocalModel, make sure your local server's max_token / context window is large enough (your request already used 3011 prompt tokens out of a 4096 total — very tight). Increase it if the backend allows.
    • Avoid "Thinking"/reasoning mode for translation, since it consumes many tokens.
  3. Alternatively, switch to a more capable channel such as DeepSeek or OpenAI/ChatGPT, which have much larger context and output limits.
  4. If you keep the local model, simplify the prompt file videotrans/prompts/srt/localllm.txt (used when "Send full SRT" is checked) or videotrans/prompts/text/localllm.txt (line-by-line). Do not modify the {} variables.

Note: local small models (7B-class) often fail to follow translation instructions and may merge lines or output stray text. For best translation quality, use an online flagship model.

请查阅相关文档:

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