Which parameter replaces max_tokens?
max_completion_tokens. The Chat Completions reference says max_tokens is not compatible with o-series models. See also the October 23 shutdown error.
o-series models reject max_tokens. The Chat Completions reference says to use max_completion_tokens. The sentence below was recorded for o1.
Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. Quoted from GitHub issue openai/openai-python#2046, checked October 20, 2026.
The Chat Completions reference says max_tokens is deprecated in favor of max_completion_tokens, and is not compatible with o-series models. max_completion_tokens is an upper bound on tokens generated for a completion, including visible output tokens and reasoning tokens. https://github.com/openai/openai-python/issues/2046 records the 400 while using o1. This page does not claim every newer model returns that same sentence. Source: OpenAI Chat Completions reference, checked October 20, 2026.
| Model id | What the source says |
|---|---|
o1 | The GitHub issue records this 400 for o1. The API reference says o-series models are not compatible with max_tokens. |
o1-2024-12-17 | o1 snapshot. Shuts down October 23, 2026. |
o3-mini | o-series id. Shuts down October 23, 2026. The quoted sentence was recorded for o1, not this id. |
o3-mini-2025-01-31 | o3-mini snapshot. Shuts down October 23, 2026. |
o4-mini | o-series id. Shuts down October 23, 2026. The quoted sentence was recorded for o1, not this id. |
o4-mini-2025-04-16 | o4-mini snapshot. Shuts down October 23, 2026. |
o1-pro | o-series id in the same October 23, 2026 deprecations table. |
Send max_completion_tokens and omit max_tokens. o1, o3-mini, and o4-mini also shut down on October 23, 2026, so the model id has to change on that date too.
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="o1",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=1000,
)
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="o1",
messages=[{"role": "user", "content": "Hello"}],
max_completion_tokens=1000,
)
Source: OpenAI Chat Completions reference, checked October 20, 2026.
LiteLLM's completion input list includes max_completion_tokens and max_tokens as separate fields. Pass max_completion_tokens.
import litellm
response = litellm.completion(
model="openai/o1",
messages=[{"role": "user", "content": "Hello"}],
max_completion_tokens=1000,
)
Source: LiteLLM completion input, checked October 20, 2026.
generateText names the cap maxOutputTokens. The OpenAI provider guide does not say that this field is sent as max_completion_tokens. The API reference is the source for the parameter name on the raw request.
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";
const { text } = await generateText({
model: openai("o1"),
prompt: "Hello",
maxOutputTokens: 1000,
});
Source: AI SDK generateText, checked October 20, 2026.
max_completion_tokens. The Chat Completions reference says max_tokens is not compatible with o-series models. See also the October 23 shutdown error.