gpt-5.x renamed max_tokens to max_completion_tokens
Migrating an OpenAI chat-completions script from gpt-4o-family models to the gpt-5.x family and hitting a 400 error on every call.
On gpt-5.x chat-completions calls, OpenAI returns HTTP 400 "Unsupported parameter: max_tokens is not supported with this model. Use max_completion_tokens instead." The rename happened with the gpt-5 generation to disambiguate reasoning output from final completion tokens. Same JSON body otherwise. If a retry helper silently swallows 400s or only logs the status code without the response body, this surfaces as a confusing 100% failure rate with no obvious cause. Always log the response body on non-2xx, even for non-retryable codes — a 400 with an explanatory message is the kindest error OpenAI hands you.
When migrating chat-completions code to a newer OpenAI model family, scan the request body for parameter names that may have been renamed (max_tokens, response_format presence, temperature support) before assuming the model identifier is the only thing that changed.