Responses API allowed_tools tool_choice parameter now failing for GPT-5

I just started getting this error from the Responses API yesterday. It worked before and is documented in the “Using GPT-5” here: https://platform.openai.com/docs/guides/latest-model#allowed-tools and in the API documentation.

Why would this suddenly start erroring?

{
  "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" }]
  }
}'

Ran into this exact same issue yesterday - just rolled out a temp block on allowed_tools

This happened to us. We didn’t change anything on our end, just started getting this error overnight and broke our AI.

Apologies for the breakage! This is being fixed!

Any idea when the fix comes out @shanth?

the fix just rolled out, let me know if you still see issues.

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}}

That doesn’t sound like this issue. Do you have sample request IDs?

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.

What does your request looks like?

@shanth I can’t seem to use tool_choice at all whenever I have any built-in tools defined in tools

stream = await llm.responses.create(
model="gpt-5",
input="What is 8\*9183\*7663?",
tools=[

    {"type": "code_interpreter", "container": {"type": "auto"}},

    {"server_label": "deepwiki", "server_url": "https://mcp.deepwiki.com/sse", "type": "mcp", "require_approval": "never"},

    get_weather,

],
tool_choice=ToolChoiceAllowedParam(
    mode="auto",
    tools=[{"type": "code_interpreter"}],
    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}}

thanks for the repro! you’re right, the behavior isn’t restored relative to the docs here. following up…

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?

tool_choice: required should force use of tool with gpt-5*.

@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?

stream = client.responses.create(

model=“gpt-5”,

input=“What is 8*9183*7663?”,

tools=[

{“type”: “code_interpreter”, “container”: {“type”: “auto”}},

{“server_label”: “deepwiki”, “server_url”: “ttps://mcp.deepwiki.com/sse”, “type”: “mcp”, “require_approval”: “never”},

get_weather,

],

tool_choice=“required”

)

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}}

That must likely be it. For example, something like this curl works:

curl -X POST https://api.openai.com/v1/responses -H "Content-Type: application/json" -H "Authorization: Bearer $OPENAI_API_KEY" -d '{
  "model": "gpt-5",
  "input": "get the latest stock prices of FAANG and plot a bar graph with it",
  "tools": [{ "type": "web_search" }, {"type": "code_interpreter", "container": {"type": "auto"}}],
  "tool_choice": "required"
}'

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:

{
  "instructions": "",
  "max_tool_calls": 2,
  "include": [
    "web_search_call.action.sources"
  ],
  "input": "",
  "model": "gpt-5-mini",
  "reasoning": {
    "effort": "medium"
  },
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tools": [
    {
      "type": "web_search"
    }
  ],
  "tool_choice": "required"
}