Error with Azure OpenAI API: max_tokens vs max_completion_tokens
Hi everyone I’m running an eval_model with llm_classify using the Azure OpenAI API, and I’m getting this error when using gpt-5-mini:
Unsupported parameter: 'max_tokens' is not supported with this model.
Use 'max_completion_tokens' instead.Digging deeper, I found this method in the codebase (OpenAIModel):
def _get_token_param_str(is_azure: bool, model: str) -> str:
"""
Get the token parameter string for the given model.
OpenAI o1 and o3 models made a switch to use
max_completion_tokens and now all the models support it.
However, Azure OpenAI models currently do not support
max_completion_tokens unless it's an o1 or o3 model.
"""
azure_reasoning_models = ("o1", "o3", "o4")
if is_azure and not model.startswith(azure_reasoning_models):
return "max_tokens"
return "max_completion_tokens"As you can see, it currently filters only for the reasoning models (o1, o3, o4) to use max_completion_tokens. However, I couldn’t find anything in the Azure docs confirming this — but it seems like the Azure endpoint might now require max_completion_tokens for the GPT-5 family as well. Question: Has anyone else experienced this or found updated documentation confirming that Azure GPT-5 models now require max_completion_tokens instead of max_tokens?
