Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/realtime/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,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://<your-resource>.openai.azure.com/openai/v1/realtime?model=<deployment-name>",
"headers": {"api-key": "<your-azure-api-key>"},
}
```

For token-based auth, use `{"authorization": f"Bearer {token}"}` in `headers`.
28 changes: 28 additions & 0 deletions docs/realtime/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -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://<your-resource>.openai.azure.com/openai/v1/realtime?model=<deployment-name>",
"headers": {"api-key": "<your-azure-api-key>"},
}
)
```

You can also use a bearer token:

```python
session = await runner.run(
model_config={
"url": "wss://<your-resource>.openai.azure.com/openai/v1/realtime?model=<deployment-name>",
"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.