GPT5 Models | Tool choices other than 'auto' are not supported with model
Open
Nobody has claimed this yet.
api
bug
- Dominant language
- Python
- Stars
- 31.6k
- Forks
- 5.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 96
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
We are unable to use any tool_choice besides 'auto' for GPT5 models in the Responses API using the latest release v.1.99.5.
Documentation:
- https://platform.openai.com/docs/guides/latest-model#allowed-tools
- https://platform.openai.com/docs/api-reference/responses/create#responses_create-tool_choice
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'.", 'type': 'invalid_request_error', 'param': 'tool_choice', 'code': None}}
Posts on community.openai.com:
- https://community.openai.com/t/error-400-tool-choices-other-than-auto-are-not-supported-with-model-gpt-5-and-the-following-tool-types-web-search-preview/1337152
- https://community.openai.com/t/gpt5-and-forced-web-search/1344079
- https://community.openai.com/t/gpt5-cannot-use-web-search-please-help/1337041
To Reproduce
stream = await llm.responses.create(
model="gpt-5",
input="Use your python tool to do this math: 8*9183*7663",
tools=[
{"type": "code_interpreter", "container": {"type": "auto"}},
],
tool_choice={
"type": "allowed_tools",
"mode": "auto",
"tools": [
{
"type": "code_interpreter",
}
],
},
stream=True,
)
async for event in stream:
print(event.model_dump_json(indent=2))
Code snippets
OS
Windows 11
Python version
Python 3.13.2
Library version
openai v.1.99.5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Responses API call in the reproduction and compare its allowed_tools tool_choice with the linked API documentation. Check whether the 400 response is caused by the Python library or the underlying API; done means the supported behavior and any required library change are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100