Home / Resources / Azure OpenAI GPT Realtime

Using Azure OpenAI GPT Realtime

Voice Nexus Service works with Microsoft Azure OpenAI GPT Realtime models in addition to the standard OpenAI API. This lets you run AI voice calls against an Azure-hosted model endpoint — useful when your organization requires data residency, enterprise agreements, or Microsoft cloud compliance.

How Azure Differs from Standard OpenAI

Both providers use the same aiUrl object in your CallStart response. With a standard OpenAI account, aiUrl.url points at OpenAI's shared endpoint and authenticates with an Authorization: Bearer header. With Microsoft Azure OpenAI, aiUrl.url points to your own Azure-hosted resource and authenticates with an api-key header.

Setting Standard OpenAI Azure OpenAI
Auth field aiUrl.headers.Authorization (Bearer) aiUrl.headers.api-key
Endpoint wss://api.openai.com/v1/realtime wss://<resource>.services.ai.azure.com/…
Model selection ?model= query param in the URL ?model= query param in the URL
Billing OpenAI account Azure subscription

Prerequisites

Before configuring VNS, you need the following set up in Microsoft Azure:

  1. 1 An Azure subscription with access to Azure AI Foundry or Azure OpenAI Service.
  2. 2 An Azure AI Foundry project or Azure OpenAI resource created in a region that supports GPT Realtime models. Visit Microsoft AI Foundry to create one.
  3. 3 A deployed GPT Realtime model — go to Models + endpoints → Deploy base model in the Foundry portal and deploy a GPT Realtime model such as gpt-realtime-2.1.
  4. 4 Your resource's WebSocket endpoint URL and API key — both available from the Azure portal (see below).

Finding Your Endpoint and API Key

In the Microsoft AI Foundry portal, navigate to your project and open Models + endpoints. Select your deployed GPT Realtime model. The endpoint details panel shows the base URL and your API key.

VNS needs the WebSocket (wss://) form of the endpoint with the model appended as a query parameter. The format is:

wss://<your-resource>.services.ai.azure.com/openai/v1/realtime?model=<model-name>

For example, a resource named monroe-7384-resource using model gpt-realtime-2.1 would be:

wss://monroe-7384-resource.services.ai.azure.com/openai/v1/realtime?model=gpt-realtime-2.1
Two endpoint formats: Microsoft exposes GPT Realtime through both .openai.azure.com (legacy Azure OpenAI Service) and .services.ai.azure.com (Azure AI Foundry). Use whichever URL the portal shows for your specific resource — both work with VNS.

Getting Your API Key

From the same endpoint details panel, copy the Key value (a long alphanumeric string). This is passed in the api-key header — not as a Bearer token.

Keep your API key secret. Do not put it directly in your CallStart response code. Use a VNS API Key Substitution placeholder so the key stays inside the VNS portal and never appears in your configuration files.

CallStart Webhook Configuration

Use the aiUrl object in your CallStart response. The aiUrl.url is your Azure WebSocket endpoint and aiUrl.headers carries the api-key.

{
  "VoiceElements_Instructions": {
    "aiUrl": {
      "url": "wss://<your-resource>.services.ai.azure.com/openai/v1/realtime?model=gpt-realtime-2.1",
      "headers": {
        "api-key": "<<vns-api-token:YourAzureKeyName>>"
      }
    },
    "maxSeconds": 300
  }
}

The <<vns-api-token:YourAzureKeyName>> syntax is a VNS placeholder — replace YourAzureKeyName with the profile name you gave the key when you stored it in the VNS portal. If you want to test quickly with a raw key, you can paste the key value directly — just remember to move it to a placeholder before going to production.

With a Raw Key (for Initial Testing)

{
  "VoiceElements_Instructions": {
    "aiUrl": {
      "url": "wss://monroe-7384-resource.services.ai.azure.com/openai/v1/realtime?model=gpt-realtime-2.1",
      "headers": {
        "api-key": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
      }
    },
    "maxSeconds": 300
  }
}

Supported Models

VNS works with any GPT Realtime model that Microsoft Azure makes available. Put the model name in the ?model= query parameter of your endpoint URL.

Available models change often and vary by Azure region. Check the Microsoft Azure documentation for the current list of models and supported regions.

Troubleshooting

Call connects but AI doesn't respond

The WebSocket connection succeeded but the model session failed to initialize. Double-check that the model name in the ?model= query parameter exactly matches the deployment name in the Azure portal (they are case-sensitive).

401 / authentication error

The api-key header value is wrong or missing. Confirm the key is copied correctly from the Azure portal — it's a long alphanumeric string with no spaces. If using a VNS placeholder, verify the profile name in the VNS portal matches exactly.

Connection refused / WebSocket error

The endpoint URL is malformed or the model isn't deployed in that region. Verify the full wss:// URL is correct and that the model deployment is in an active state in the Azure portal (not throttled or failed).

Model not available in my region

GPT Realtime models are only available in certain Azure regions. If your existing resource is in an unsupported region, create a new Azure AI Foundry resource in a supported region (East US 2, Sweden Central, and West US 3 are commonly available). Check the Microsoft documentation for the current region list.

Ready to Automate Your Phone Lines?

Create your account in VnsPortal and set up your first agent from a template today — or book a live demo and we'll walk you through it.

Questions first? Contact sales