Skip to content

Encrypted content is not supported for GPT-5 though Azure #2915

@alibeyram

Description

@alibeyram

Initial Checks

Description

when running gpt-5 through Azure you get the following error

ModelHTTPError: status_code: 400, model_name: gpt-5, body: {'message': 'Encrypted content is not supported with this model.', 'type': 'invalid_request_error', 'param': 'include', 'code': None}

Example Code

import os

from openai import AsyncAzureOpenAI
from pydantic import BaseModel
from pydantic_ai import Agent, NativeOutput
from pydantic_ai.models.openai import OpenAIResponsesModel
from pydantic_ai.providers.openai import OpenAIProvider


class CalendarEvent(BaseModel):
    name: str
    date: str
    participants: list[str]


client = AsyncAzureOpenAI(
    azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
    api_version=os.environ["OPENAI_API_VERSION"],
    api_key=os.getenv("AZURE_OPENAI_API_KEY"),
)

model = OpenAIResponsesModel(
    model_name="gpt-5",
    provider=OpenAIProvider(openai_client=client),
)

agent = Agent(
    model=model,
    tools=[],
    system_prompt="Extract the event information.",
    output_type=NativeOutput(CalendarEvent),
)
result = await agent.run(
    [
        "Alice and Bob are going to a science fair on Friday.",
    ]
)

Python, Pydantic AI & LLM client version

python -V
Python 3.13.7

import pydantic_ai
pydantic_ai.__version__
'1.0.2'

Metadata

Metadata

Assignees

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