OpenAI API · api · fg-0132

400 'Unsupported parameter: max_tokens is not supported with this model' on reasoning models

If you see Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead, the cause and the fix for OpenAI API are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.Code that worked with gpt-4o fails after switching the model name
Cause
max_tokens is deprecated on Chat Completions and is not accepted by reasoning models. The limit there is max_completion_tokens, which also counts hidden reasoning tokens.
Fix
Send max_completion_tokens on Chat Completions, or max_output_tokens on the Responses API.
Apply
const r = await client.chat.completions.create({ model, messages, max_completion_tokens: 4000 });
Affected
OpenAI Chat Completions with o-series and GPT-5 family reasoning models, since o1 (late 2024), checked October 2026
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun