排查记录:Kimi API 调用一直正常的接口突然报错 invalid temperature 的解决过程
·
今天遇到一个有点 “奇怪” 的问题:之前包括昨天一直调用正常的 Kimi API 接口,今天(2026 年 3 月 24 日)突然返回 400 错误,我一开始以为是模型下线了,查了文档没有通知,然后为了调试问题,代码加上了print
# 发送POST请求
response = requests.post(MODEL_API_URL, headers=headers, json=data)
# 解析返回的结果
if response.status_code == 200:
result = response.json()
diary_entry = result['choices'][0]['message']['content'].strip()
return diary_entry
else:
error = response.json()
print(f"error: status={response.status_code}, type='{error['error']['type']}', message='{error['error']['message']}'")
return f"Kimi模型请求失败:{response.status_code}"
报错信息是 invalid temperature: only 1 is allowed for this model,整理下排查和解决过程,供遇到类似问题的同学参考。
问题现象
相同的代码、相同的 API Key、相同的模型(moonshot-v1-8k),前几天调用都正常,今天突然报错,核心错误提示指向 temperature 参数 —— 该模型仅允许此参数值为 1。
解决方法
核心修改只有一步:将调用 Kimi API 时的 temperature 参数固定为 1。
#"temperature": MODEL_TEMPERATURE "temperature": 1
然后调用就成功了。
更多推荐

所有评论(0)