Skip to content

ModelHTTPError caused by OpenAI client: Item of type 'function_call' was provided without its required 'reasoning' item #3230

@lukekh

Description

@lukekh

Initial Checks

Description

For starters, I think this is an issue with the underlying OpenAI client (potentially specific to gpt-5-mini e.g. this issue on mastra-ai), but it's causing me headaches.

I am getting this ModelHTTPError:

pydantic_ai.exceptions.ModelHTTPError: status_code: 400, model_name: gpt-5-mini, body: {'message': "Item 'fc_07f6eeb33dcce30d0068f9013ddefc8197aebff46ad603c528' of type 'function_call' was provided without its required 'reasoning' item: 'rs_07f6eeb33dcce30d0068f9013469b8819788dc43b3e5223aaf'.", 'type': 'invalid_request_error', 'param': 'input', 'code': None}

It's hard to get around and grinds my code to a halt. It seems to be fairly temperamental too, only occurring every now and again.

I have the settings

OpenAIResponsesModelSettings(
    openai_previous_response_id="auto",
    openai_truncation="auto",
    parallel_tool_calls=True,
    openai_send_reasoning_ids=False,
    openai_reasoning_effort="medium",
)

enabled and originally I had thought setting openai_send_reasoning_ids=False had fixed it, but alas!

Example Code

Python, Pydantic AI & LLM client version

Python 3.11.13, pydantic-ai==1.2.1, Azure OpenAI with gpt-5-mini

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions