Hello.😊
I tested the websocket fetch approach with @ai-sdk/azure and Azure OpenAI Responses API WebSocket mode.
I created an Azure-focused fork here: https://github.com/tsuzaki430/ai-sdk-azure-openai-websocket Pull requests merged into my fork
The fork intentionally does not preserve @ai-sdk/openai compatibility. My goal was to validate the Azure-specific path first, not to design the provider-compatible abstraction.
As a result, I found that this can be achieved without making any changes to @ai-sdk/azure.
The main Azure-specific differences I had to handle were:
- Azure Responses API URL shape:
/openai/v1/responses - Azure provider sends API keys via the
api-keyheader - Azure WebSocket handshake expects
Authorization: Bearer <api-key> - OpenAI-specific beta headers should not be sent to Azure
- WebSocket URL needs to be derived from the Azure request URL
Activity
2@rahulbhadja Thanks!😊 That could make sense eventually. For now, since the code is still small, I think a smaller first step might be to add a separate Azure-specific export while keeping the existing OpenAI behavior as the default.
Good work @tsuzaki430, maybe do pr on this and have an upper-level provider support, defaulting to openai?