Skip to content

azure

The Azure OpenAI realtime model reuses the OpenAI Realtime codec and connection, authenticates with AzureProvider, and so needs the realtime and openai optional groups (pip install "pydantic-ai-slim[realtime,openai]").

Azure OpenAI realtime support using the OpenAI GA protocol.

AzureRealtimeConnection

Bases: OpenAIRealtimeConnection

A live WebSocket connection to Azure OpenAI’s realtime API.

Reuses OpenAIRealtimeConnection for the shared GA wire protocol, naming Azure as the vendor so a connection that drops or rejects content doesn’t send someone debugging an Azure session to OpenAI’s status page.

AzureTokenCredential

Bases: Protocol

Structural type for a synchronous Microsoft Entra ID token credential.

AzureRealtimeModel

Bases: OpenAIRealtimeModel

Azure OpenAI realtime model using the OpenAI GA protocol.

The existing AzureProvider supplies the Azure resource endpoint and API key. The WebSocket transport does not use its OpenAI SDK client or api_version; it connects to the GA /openai/v1/realtime endpoint with an api-key header.

Methods

__init__
def __init__(
    model: AzureRealtimeModelName,
    *,
    provider: Provider[AsyncOpenAI] | str = 'azure',
    settings: RealtimeModelSettings | None = None,
    profile: RealtimeModelProfileSpec | None = None,
    credential: AzureTokenCredential | None = None,
) -> None

Create an Azure OpenAI realtime model.

Returns

None

Parameters

model : AzureRealtimeModelName

The Azure deployment name, which is what the realtime URL and the profile lookup use. Azure deployments are conventionally named after their model; when yours isn’t, profile is how to correct the facts inferred from the name.

provider : Provider[AsyncOpenAI] | str Default: 'azure'

The provider supplying the resource endpoint and API key. Defaults to 'azure'.

settings : RealtimeModelSettings | None Default: None

Model settings used as defaults for realtime sessions.

profile : RealtimeModelProfileSpec | None Default: None

Optional override for the realtime model profile, merged over the provider’s — a partial dict, or a callable taking the resolved profile and returning the one to use.

credential : AzureTokenCredential | None Default: None

Optional Microsoft Entra ID credential. When set, realtime requests use its bearer tokens instead of the resource API key.