{
"error": {
"message": "Tool choice type 'allowed_tools' is not supported with model 'gpt-5'",
"type": "invalid_request_error",
"param": "tool_choice",
"code": null
}
}
curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-5",
"input": "What is the weather like in Boston today?",
"tools": [
{
"type": "function",
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location", "unit"]
}
}
],
"tool_choice": {
"type": "allowed_tools",
"mode": "auto",
"tools": [{ "type": "function", "name": "get_weather" }]
}
}'
i checked openai status page and says you guys are experiencing issues on file_search. Is that it? More than half of my responses are hanging with gpt 5, on both mini and normal even with minimal reasoning. Just wanted to know if this is an issue that is known or if it is working as intended.
@shanth I’m still getting this error when trying to use tool_choice and there are built-in tools. I’m using Azure OpenAI, maybe it’s an Azure problem?
BadRequestError: Error code: 400 - {'error': {'message': "Tool choices other than 'auto' are not supported with model 'gpt-5-mini-2025-08-07' and the following tool types: 'code_interpreter', 'file_search', 'mcp'.", 'type': 'invalid_request_error', 'param': 'tool_choice', 'code': None}}
With gpt-5* models, I think built-in tools are supported only with either tool_choice: auto, or with mode: auto when tool_choice is type: allowed_tools.
BadRequestError: Error code: 400 - {‘error’: {‘message’: “Tool choices other than ‘auto’ are not supported with model ‘gpt-5-2025-08-07’ and the following tool types: ‘code_interpreter’, ‘mcp’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘tool_choice’, ‘code’: None}}
confirmed that the behavior is consistent with how things were before. basically, if tools array includes a hosted tool, tool_choice: allowed_tools is unsupported with gpt-5*. we’re updating the docs to reflect this.
thanks for looking into this @shanth ! So in my example where i have code_interpreter, MCP, and a custom function, how can we force GPT5* to use a specific tool?
@shanth I have tried every way available but only tool_choice=’auto’ works when built-in tools are defined. I’m using Azure OpenAI api_verision=’preview’, maybe that’s it? Can you confirm tool_choice=ToolChoiceTypesParam(type="code_interpreter"), works with GPT5* without Azure OpenAI?
BadRequestError: Error code: 400 - {‘error’: {‘message’: “Tool choices other than ‘auto’ are not supported with model ‘gpt-5-2025-08-07’ and the following tool types: ‘code_interpreter’, ‘mcp’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘tool_choice’, ‘code’: None}}
I see that some people were getting errors. That’s not the case for us, it just hangs there without returning any response. This only happens when we set tool_choice = “required”. Any ideas?
This is an example request where I’ve removed the input and instructions: