rtclient.low_level_client.ConnectionError: Received status code 400 from the server

Vandanaa S 0 Reputation points
2025-02-27T04:24:37.3733333+00:00

Hi

I am using GPT model "gpt-4o-mini-realtime-preview". I took sample code from "https://learn.microsoft.com/en-us/azure/ai-services/openai/realtime-audio-quickstart?tabs=api-key%2Cwindows&pivots=programming-language-python" and followed the instructions mentioned. I am encountering the below error :

\VirtualEnvironment\Lib\site-packages\rtclient\low_level_client.py", line 100, in

connect

**raise ConnectionError(error_message, e.headers) from e**

rtclient.low_level_client.ConnectionError: Received status code 400 from the server

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,732 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SriLakshmi C 2,845 Reputation points Microsoft Vendor
    2025-02-27T09:40:24.27+00:00

    Hello Vandanaa S,

    Greetings and Welcome to Microsoft Q&A!

    I tried to reproduce the scenario in my environment, and it is working fine for me. Here is the screenshot,User's image

    To resolve the issue, try the following steps:

    The Real-Time Audio API is region-specific and only works in East US 2 and Sweden Central. If you are using any other region, you will receive a 401 error. Ensure that you are deploying the service in one of these supported regions.

    Use the endpoint and API keys directly from Azure OpenAI and not from Azure AI Foundry. When configuring your script, avoid using environment variables and instead provide the API key, endpoint, and deployment name explicitly.

    Cross-check that the API key, endpoint, and deployment name are correct and match your Azure OpenAI resource settings.

    I hope you understand. And, if you have any further query do let us know.

    Thank you!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.