硬编码 temperature/max_tokens 导致仅允许 temperature=1 的模型(Kimi K3、GLM 推理模型等)400 报错
Author: JOJO6618Created Sep 8, 2026Updated Sep 9, 2026
现象:使用 Kimi K3(api.kimi.com)等仅允许 temperature=1 的推理模型时,「测试连接」与短剧混剪链路均报 400 - invalid temperature: only 1 is allowed for this model。在界面把 temperature 设为 1 无效。
原因:
step1_subtitle_analyzer_openai.py 三处调用硬编码 temperature=0.1, max_tokens=4000(约 L179/L313/L375),覆盖 config.toml 中的设置 测试连接按钮(basic_settings.py ~L545/L584)同样硬编码 0.1 openai_compatible_provider.py 的 _build_chat_completion_options 无条件把 temperature/top_p 写入请求 影响:所有锁定采样参数的模型完全无法使用;且 max_tokens=4000 对推理模型偏小——reasoning_content的 token 会占掉额度导致 JSON 输出截断、解析失败。
建议:调用处删除硬编码,统一走 config.toml;provider 层改为只有显式提供时才传递,未配置时不传由服务端使用默认值。
Source: linyqh/NarratoAI