Azure OpenAI - gpt-4o-transcribe-diarize

Surya Alla 20 Reputation points
2025-10-21T14:28:01.7433333+00:00

Hi,

I'm trying to use gpt-4o-transcribe-diarize model from AzureOpenAI and can't seem to hit the right endpoint.

Wanted to check if anyone has a working C# sample?

 internal class Program
 {
     // Configure with your Azure OpenAI endpoint + key + deployment
     private const string Endpoint = "https://{resource}.openai.azure.com";
     private const string ApiKey = "apiKey";      
     private const string DeploymentName = "gpt-4o-transcribe-diarize";  
     private const string ApiVersion = "2025-04-01-preview"; 
      private const string AudioFilePath = @"C:\temp\audio\abc.mp3";    

   static async Task Main()      {    
      Console.WriteLine("Running diarization...");    
      var response = await TranscribeAndDiarizeAsync(AudioFilePath);
         Console.WriteLine("Response received:");
         Console.WriteLine(response);
     }

     private static async Task<string> TranscribeAndDiarizeAsync(string audioPath)
     {
         if (!File.Exists(audioPath))
             throw new FileNotFoundException("Audio file not found.", audioPath);

         using var client = new HttpClient();
         client.DefaultRequestHeaders.Add("api-key", ApiKey);

         // Build multipart/form-data body
         using var form = new MultipartFormDataContent();

         // Attach audio file
         var fileBytes = await File.ReadAllBytesAsync(audioPath);
         var fileContent = new ByteArrayContent(fileBytes);
         fileContent.Headers.ContentType = new MediaTypeHeaderValue("audio/wav");
         form.Add(fileContent, "file", Path.GetFileName(audioPath));

         // Required fields
         form.Add(new StringContent("gpt-4o-transcribe-diarize"), "model");
         form.Add(new StringContent("diarized_json"), "response_format");

         // Optional: auto chunking for long audio
         form.Add(new StringContent("auto"), "chunking_strategy");

         // Optional: speaker hints (if known)
         form.Add(new StringContent("agent"), "known_speaker_names[]");
         // example reference audio (fake data URI here)
         form.Add(new StringContent("data:audio/wav;base64,AAA..."), "known_speaker_references[]");

         string requestUrl = $"{Endpoint}/openai/deployments/{DeploymentName}/audio/transcriptions?api-version=2025-04-04";         

  using var response = await client.PostAsync(requestUrl, form);
         string result = await response.Content.ReadAsStringAsync();

         if (!response.IsSuccessStatusCode)
         {
             Console.WriteLine($"Error: {response.StatusCode}");
             Console.WriteLine(result);
             throw new Exception($"Azure OpenAI diarization failed: {result}");
         }

         return result;
     }
 }

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

Answer accepted by question author
  1. Manas Mohanty 11,700 Reputation points Microsoft External Staff Moderator
    2025-10-21T15:15:49.9733333+00:00

    Hi Surya Alla

    gpt-4o-transcribe-diarize models does not seem to have C# or Python SDK support yet.

    Please use rest api with below API version (mismatch found)

    api-version=2025-03-01-preview"
    

    User's image

    curl -X POST "https://<openaiaccountname>.cognitiveservices.azure.com/openai/deployments/gpt-4o-transcribe-diarize/audio/transcriptions?api-version=2025-03-01-preview" \   -H "Content-Type: multipart/form-data" \
      -H "Authorization: Bearer $AZURE_API_KEY" \
      -d '{
         "model": "gpt-4o-transcribe-diarize",
         "file": "@path/to/file/audio.mp3"
        }'
    
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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