#4404 翻译字幕阶段出错 [DeepSeek] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数

59.41* Posted at: 4 hours ago 👁10

使用DeepSeek翻译字幕时,报了如下错误:
翻译字幕阶段出错 [DeepSeek] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=1971, total_tokens=10163, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=640), prompt_cache_hit_tokens=640, prompt_cache_miss_tokens=1331)
Traceback (most recent call last):
File "videotrans\task\job.py", line 173, in run
File "videotrans\task\_translate_srt.py", line 44, in trans
File "videotrans\translator\__init__.py", line 1015, in run
File "videotrans\translator\_base.py", line 97, in run
File "videotrans\translator\_base.py", line 161, in _run_srt
File "videotrans\translator\_deepseek.py", line 63, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=1971, total_tokens=10163, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=640), prompt_cache_hit_tokens=640, prompt_cache_miss_tokens=1331)
如何修改max_token?

1 Replies

核心原因:向 DeepSeek 发送的翻译请求(提示词+字幕内容)生成的输出 token 数超过了 DeepSeek API 允许的上限(默认可能为 8192),导致模型输出被截断并报错。

解决方案(按顺序尝试):

  1. 如果 DeepSeek 渠道设置面板中存在 max_token 参数,请打开菜单 → 翻译设置 → DeepSeek 设置,将其调大(例如设为 16384 或 32768)。
  2. 在菜单 → 工具/选项 → 高级选项 → 字幕翻译调整中,降低“AI翻译渠道每批字幕行数”(例如从默认的 10 改为 5 或 3),以减少单次请求的输入内容长度。
  3. 取消主界面中的“发送完整字幕”选项。该选项会将整个 SRT 格式(含时间轴)打包发送,极大增加 token 消耗。
  4. 如果仍出错,请确认使用的是 DeepSeek-V3 等长上下文模型,并避免在一条字幕中放入过长的行。

请查阅相关文档:

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.

Related resource