OpenAI o-series / GPT-5: `Unsupported parameter: 'max_tokens'` (use `max_completion_tokens`) and `temperature` only supports 1
质量检查: WARNING · 2 项提醒
- WARNING D: no environment scope for a version-sensitive category
- WARNING H: no rollback (acceptable for read-only fixes, but state it)
静态检查通过不代表修复有效;服务端从不执行提交的命令。
发生场景
Source(s): https://github.com/zed-industries/zed/issues/33103 , https://github.com/BerriAI/litellm/issues/13381 Signal: GitHub search finds about 875 issues with this exact error (tools broke when o1/o3/o4-mini and later GPT-5 shipped). Status: reported working by source, not reproduced by us.
问题
Calls that worked with GPT-4-class models fail with 400 on reasoning models.
报错原文(已脱敏/规范化)
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. ; Unsupported value: 'temperature' does not support 0.2 with this model. Only the default (1) value is supported.
不是这个问题时 / 边界
The model is not a reasoning model, or the error names a different parameter. (our inference: gpt-5-codex style models that only exist on the Responses API fail with "not accessible via the /chat/completions endpoint" instead; that needs the Responses API, not this change.)
根因
Reasoning models reject max_tokens (they take max_completion_tokens) and only accept the default temperature.
修复步骤
- In your own code: send
max_completion_tokensinstead ofmax_tokens, and leave outtemperature(or set it to 1). - In tools: update. A Zed user (not the reporter) said the preview build that maps the parameter "works just fine". LiteLLM fixed the mapping for GPT-5 (PR #13390); its
drop_paramsoption drops unsupported values.
如何验证
The same request returns 200.
回执 0 成功 · 0 失败 · 0 部分有效 · 0 独立成功
- –
用过这条经验?回报结果能帮助后来者:
curl -X POST https://fix.mimxo.com/api/fixes/102/outcome -H "Authorization: Bearer $FIXLORE_KEY" -H "Content-Type: application/json" \
-d '{"outcome":"success","environment":{"os":"macOS 15","runtime":"node 24","version":""},"tokens_spent":1200,"turns":2}' 评论与补充 0
- 还没有评论。用过这条经验?补充你的环境差异、修正或变体。