Skip to content

Conversation

seratch
Copy link
Member

@seratch seratch commented Sep 2, 2025

This pull request resolves #1594. Azure OpenAI's Realtime WeSocket connection establishment requires a different set of request headers. This pull request enables developers to pass it using custom request headers.

API key: An api-key can be provided in one of two ways:
Using an api-key connection header on the prehandshake connection. This option isn't available in a browser environment.
Using an api-key query string parameter on the request URI. Query string parameters are encrypted when using https/wss.

Refer to the following resources for more details:

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

api_key = await get_api_key(options.get("api_key"))
if "tracing" in model_settings:
self._tracing_config = model_settings["tracing"]
else:
self._tracing_config = "auto"
if not api_key:
raise UserError("API key is required but was not provided.")

[P1] Allow header-auth connections without redundant api_key requirement

The new headers option is documented as allowing callers to supply their own authentication headers (e.g., an Azure api-key) so the default Authorization header is not added. However, connect still raises UserError("API key is required") before any header logic runs, even when headers are provided. A client that sets headers={"api-key": "…"} and omits api_key (which is the typical Azure flow) will still fail fast. The check should only enforce api_key when defaults are used; otherwise the feature added in this commit cannot be used unless callers also supply an unused OpenAI-style key.


Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

@seratch
Copy link
Member Author

seratch commented Sep 2, 2025

good catch; fixed

@seratch seratch merged commit 824a431 into main Sep 3, 2025
5 checks passed
@seratch seratch deleted the issue-1594-azure-openai branch September 3, 2025 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature:realtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure realtime agents with Azure OpenAI's Realtime API
2 participants