openai
#10524
parameter_error
Unsupported parameter: the specified parameter is not supported with this model. Use the correct alternative parameter as instructed.
This error has been identified and solved.
Reason
The error you are encountering is due to the deprecation of the max_tokens parameter in favor of max_completion_tokens for certain OpenAI models, particularly the newer "o1" series models.
The
max_tokensparameter is no longer supported for the "o1" series models (such aso1-previewando1-mini), as it does not account for the internal reasoning tokens generated by these models.The new
max_completion_tokensparameter is designed to control the total number of tokens generated, including both visible completion tokens and internal reasoning tokens. This is necessary because the total tokens generated by the o1 series models can exceed the number of visible tokens due to these reasoning tokens.
In contrast, older models like GPT-4 still use the max_tokens parameter, which is why you might see inconsistencies depending on the model you are using.
Solution
To fix the error, you need to use the correct parameter based on the OpenAI model you are utilizing.
For o1 series models (e.g., o1-preview, o1-mini):
Use
max_completion_tokensinstead ofmax_tokens.
For GPT-4 models:
Continue using
max_tokensasmax_completion_tokensis not compatible with these models.
Ensure you update your API requests accordingly to match the model's requirements.
Suggested Links
https://community.zapier.com/troubleshooting-99/chatgpt-error-400-max-token-is-too-large-32768-this-model-supports-at-most-4096-completion-tokens-39804
https://github.com/spring-projects/spring-ai/issues/1411
https://learn.microsoft.com/en-sg/answers/questions/2139738/openai-badrequesterror-error-code-400-((error-((me
https://community.openai.com/t/error-encountered-when-using-max-tokens-parameter-with-gpt-4-api/436386
https://platform.openai.com/docs/guides/reasoning/advice-on-prompting
https://community.make.com/t/issue-with-max-completion-tokens-in-openai-o1-models/56099
https://learn.microsoft.com/en-us/answers/questions/2139738/openai-badrequesterror-error-code-400-((error-((me



