You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(openai): expose AsyncAPI server variable + subprotocol-auth
Wire tryAGI/AutoSDK #277 and #278 through asyncapi.json so the
generated OpenAiRealtimeClient surfaces:
- `ConnectAsync(string model, …)` — new typed overload that appends
`?model=<model>` to the WebSocket URL via the AsyncAPI
`servers[*].variables.model` declaration.
- `AuthorizeUsingSubprotocol(string apiKey)` + `useSubprotocolAuth`
parameter on ConnectAsync — browser-compatible auth that sends the
API key as a WebSocket subprotocol instead of an Authorization
header (which the JS WebSocket constructor can't set).
Kept to a single subprotocol template to avoid the codegen bug I
filed as tryAGI/AutoSDK#282 (duplicate `__subProtocol` locals when
>1 template). The literal `realtime` subprotocol that OpenAI also
requires can be passed via `additionalSubProtocols` on ConnectAsync
until #282 lands, after which we can move it back into the scheme.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
/// Connects to the WebSocket server with typed connection parameters.
208
+
/// </summary>
209
+
/// <param name="model">Realtime model ID. The generator emits this as a required parameter on ConnectAsync and appends it to the URL as ?model=<id>.</param>
"description": "OpenAI API key as a Bearer token."
370
+
},
371
+
"subprotocol": {
372
+
"type": "apiKey",
373
+
"description": "Browser-compatible auth via WebSocket subprotocols. When ConnectAsync is called with useSubprotocolAuth: true, the client advertises `openai-insecure-api-key.<apiKey>`, avoiding the need to set an Authorization header (which browsers disallow on the JS WebSocket constructor).\n\nOpenAI also expects the `realtime` subprotocol on the connection; include it via the `additionalSubProtocols` parameter on ConnectAsync.\n\nNOTE: single template until tryAGI/AutoSDK codegen bug (duplicate __subProtocol locals with >1 template) is fixed.",
0 commit comments