From 91edbdc0fb054249b10bbe063c4810bba3b5c54a Mon Sep 17 00:00:00 2001 From: liweiguang Date: Mon, 9 Feb 2026 11:42:26 +0800 Subject: [PATCH 1/2] docs: clarify Azure Realtime GA endpoint configuration --- docs/realtime/guide.md | 12 ++++++++++++ docs/realtime/quickstart.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/docs/realtime/guide.md b/docs/realtime/guide.md index 1bdc059fa1..84a0bdd1e5 100644 --- a/docs/realtime/guide.md +++ b/docs/realtime/guide.md @@ -50,6 +50,18 @@ Key differences from regular agents: The session configuration allows you to control the underlying realtime model behavior. You can configure the model name (such as `gpt-realtime`), voice selection (alloy, echo, fable, onyx, nova, shimmer), and supported modalities (text and/or audio). Audio formats can be set for both input and output, with PCM16 being the default. +When connecting to Azure OpenAI, use the GA Realtime endpoint format and pass credentials via +headers in `model_config`: + +```python +model_config = { + "url": "wss://.openai.azure.com/openai/v1/realtime?model=", + "headers": {"api-key": ""}, +} +``` + +For token-based auth, use `{"authorization": f"Bearer {token}"}` in `headers`. + ### Audio configuration Audio settings control how the session handles voice input and output. You can configure input audio transcription using models like Whisper, set language preferences, and provide transcription prompts to improve accuracy for domain-specific terms. Turn detection settings control when the agent should start and stop responding, with options for voice activity detection thresholds, silence duration, and padding around detected speech. diff --git a/docs/realtime/quickstart.md b/docs/realtime/quickstart.md index a88cdbf22e..7260bfec85 100644 --- a/docs/realtime/quickstart.md +++ b/docs/realtime/quickstart.md @@ -226,3 +226,31 @@ Or pass it directly when creating the session: ```python session = await runner.run(model_config={"api_key": "your-api-key"}) ``` + +## Azure OpenAI endpoint format + +If you connect to Azure OpenAI instead of OpenAI's default endpoint, pass a GA Realtime URL in +`model_config["url"]` and set auth headers explicitly. + +```python +session = await runner.run( + model_config={ + "url": "wss://.openai.azure.com/openai/v1/realtime?model=", + "headers": {"api-key": ""}, + } +) +``` + +You can also use a bearer token: + +```python +session = await runner.run( + model_config={ + "url": "wss://.openai.azure.com/openai/v1/realtime?model=", + "headers": {"authorization": f"Bearer {token}"}, + } +) +``` + +Avoid using the legacy beta path (`/openai/realtime?api-version=...`) with realtime agents. The +SDK expects the GA Realtime interface. From bc457ea14d7b65a9f340d251ba6551afc185a0dc Mon Sep 17 00:00:00 2001 From: liweiguang Date: Tue, 10 Feb 2026 10:07:59 +0800 Subject: [PATCH 2/2] docs(realtime): move Azure endpoint guidance to dedicated section --- docs/realtime/guide.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/realtime/guide.md b/docs/realtime/guide.md index 84a0bdd1e5..978b0b0e0a 100644 --- a/docs/realtime/guide.md +++ b/docs/realtime/guide.md @@ -50,18 +50,6 @@ Key differences from regular agents: The session configuration allows you to control the underlying realtime model behavior. You can configure the model name (such as `gpt-realtime`), voice selection (alloy, echo, fable, onyx, nova, shimmer), and supported modalities (text and/or audio). Audio formats can be set for both input and output, with PCM16 being the default. -When connecting to Azure OpenAI, use the GA Realtime endpoint format and pass credentials via -headers in `model_config`: - -```python -model_config = { - "url": "wss://.openai.azure.com/openai/v1/realtime?model=", - "headers": {"api-key": ""}, -} -``` - -For token-based auth, use `{"authorization": f"Bearer {token}"}` in `headers`. - ### Audio configuration Audio settings control how the session handles voice input and output. You can configure input audio transcription using models like Whisper, set language preferences, and provide transcription prompts to improve accuracy for domain-specific terms. Turn detection settings control when the agent should start and stop responding, with options for voice activity detection thresholds, silence duration, and padding around detected speech. @@ -211,3 +199,17 @@ This gives you direct access to the [`RealtimeModel`][agents.realtime.model.Real ## Examples For complete working examples, check out the [examples/realtime directory](https://github.com/openai/openai-agents-python/tree/main/examples/realtime) which includes demos with and without UI components. + +## Azure OpenAI endpoint format + +When connecting to Azure OpenAI, use the GA Realtime endpoint format and pass credentials via +headers in `model_config`: + +```python +model_config = { + "url": "wss://.openai.azure.com/openai/v1/realtime?model=", + "headers": {"api-key": ""}, +} +``` + +For token-based auth, use `{"authorization": f"Bearer {token}"}` in `headers`.