OpenAI API · api · fg-0132

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

Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

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 });

Affects: OpenAI Chat Completions with o-series and GPT-5 family reasoning models, since o1 (late 2024), checked October 2026

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp