Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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;
}
}
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"
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"
}'