- 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