Skip to content

com.openai.unity 8.8.0#391

Merged
StephenHodgson merged 1 commit intomainfrom
development
Jul 2, 2025
Merged

com.openai.unity 8.8.0#391
StephenHodgson merged 1 commit intomainfrom
development

Conversation

@StephenHodgson
Copy link
Copy Markdown
Member

  • Improved RealtimeSession websocket support for proxies
    • Proxy no longer handles the websocket connection directly, but instead initiates the connection to the OpenAI api directly using the ephemeral api key

- Improved RealtimeSession websocket support for proxies
  - Proxy no longer handles the websocket connection directly, but instead initiates the connection to the OpenAI api directly using the ephemeral api key
@StephenHodgson StephenHodgson marked this pull request as ready for review July 2, 2025 17:10
Copilot AI review requested due to automatic review settings July 2, 2025 17:10
@StephenHodgson StephenHodgson linked an issue Jul 2, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the Unity OpenAI package to v8.8.0 by enhancing RealtimeSession proxy support—sessions now use ephemeral API keys for direct WebSocket connections and URL utilities are refactored.

  • Bumped package version to 8.8.0
  • Added ClientSecret/ExpiresAfter support and JSON constructors in Realtime models
  • Refactored endpoint URL construction and replaced proxy WebSocket initialization

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
package.json Version bumped to 8.8.0
Runtime/Realtime/SessionConfiguration.cs Added expiresAfter, ClientSecret, JSON ctor and Ignore defaults
Runtime/Realtime/ServerVAD.cs Made Type setter-private and added JSON ctor
Runtime/Realtime/SemanticVAD.cs Made Type setter-private and added JSON ctor
Runtime/Realtime/RealtimeEndpoint.cs Replaced CreateWebSocket usage with Rest POST + direct WebSocket init
Runtime/Realtime/ExpiresAfter.cs New class for JSON expires_after and implicit int conversion
Runtime/Realtime/ClientSecret.cs New class for handling ephemeral API keys
Runtime/OpenAIClient.cs Removed old CreateWebSocket method
Runtime/Extensions/VoiceActivityDetectionSettingsConverter.cs Added null-check in converter
Runtime/Common/OpenAIBaseEndpoint.cs Removed IsWebSocketEndpoint; introduced GetWebsocketUri
Runtime/Authentication/OpenAISettingsInfo.cs Simplified WebSocket URL format to always use WSS
Comments suppressed due to low confidence (3)

OpenAI/Packages/com.openai.unity/Runtime/Realtime/RealtimeEndpoint.cs:79

  • The call to send the initial configuration (UpdateSessionRequest) after establishing the WebSocket connection was removed, which may prevent the session from being initialized correctly. Consider reinstating this SendAsync call to ensure the server receives the session parameters.
                session.Configuration = sessionResponse.SessionConfiguration;

OpenAI/Packages/com.openai.unity/Runtime/Authentication/OpenAISettingsInfo.cs:74

  • Hardcoding the WebSocket URL to use the default OpenAI domain (OpenAIDomain) removes support for custom or self-hosted domains. To maintain flexibility, consider constructing BaseWebSocketUrlFormat from the provided domain parameter similar to BaseRequestUrlFormat.
            BaseWebSocketUrlFormat = $"{WSS}{OpenAIDomain}{BaseRequest}{{0}}";

OpenAI/Packages/com.openai.unity/Runtime/Realtime/RealtimeEndpoint.cs:44

  • The new direct REST POST and WebSocket initialization flow isn't covered by existing tests. Adding unit or integration tests for the /sessions POST path and WebSocket connection logic will help prevent regressions.
            var payload = JsonConvert.SerializeObject(configuration, OpenAIClient.JsonSerializationOptions);

@StephenHodgson StephenHodgson merged commit c45a8f5 into main Jul 2, 2025
4 of 18 checks passed
@StephenHodgson StephenHodgson deleted the development branch July 2, 2025 17:14
github-actions Bot pushed a commit that referenced this pull request Jul 2, 2025
- Improved RealtimeSession websocket support for proxies
  - Proxy no longer handles the websocket connection directly, but instead initiates the connection to the OpenAI api directly using the ephemeral api key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

websocket connection failed to Azure OpenAI realtime API

2 participants