New field max_completion_tokens
added by OpenAI, is to set an upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. Replaces max_tokens
field which is now deprecated.
max_completion_tokens
works on all models but max_tokens
doesn't work on the new models - o1-mini etc
https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_completion_tokens
Comment From: markpollack
max_tokens
Deprecated
integer or null
Optional
The maximum number of [tokens](https://platform.openai.com/tokenizer) that can be generated in the chat completion. This value can be used to control [costs](https://openai.com/api/pricing/) for text generated via API.
This value is now deprecated in favor of max_completion_tokens, and is not compatible with [o1 series models](https://platform.openai.com/docs/guides/reasoning).
for reference
Comment From: tzolov
resolved by f56ce20cade7523396a2ce8728c856b0c0a159c0