SunsetDiff

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

o-series models reject max_tokens. The Chat Completions reference says to use max_completion_tokens. The sentence below was recorded for o1.

Error text

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.

Affected models

o-series ids in the October 23, 2026 shutdown. The quoted 400 was recorded for o1.
Model idWhat 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.

Fix

Raw SDK

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.

Before

from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
    model="o1",
    messages=[{"role": "user", "content": "Hello"}],
    max_tokens=1000,
)

After

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

LiteLLM's completion input list includes max_completion_tokens and max_tokens as separate fields. Pass max_completion_tokens.

Python

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.

Vercel AI SDK

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.

TypeScript

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.

Shutdown pages

Switch guides

More request errors

All request errors

Questions

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.

Deprecation alerts

We email you before models shut down. Unsubscribe anytime.

Deprecation alert signup
Providers (optional)