Skip to content

Commit 772b706

Browse files
authored
🎙️ fix: Azure OpenAI Speech-to-Text 400 Bad Request Error (danny-avila#10355)
1 parent 06fcf79 commit 772b706

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

api/server/services/Files/Audio/STTService.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ class STTService {
227227
}
228228

229229
const headers = {
230-
'Content-Type': 'multipart/form-data',
231230
...(apiKey && { 'api-key': apiKey }),
232231
};
233232

packages/api/src/utils/azure.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ export const genAzureEndpoint = ({
2525
azureOpenAIApiInstanceName: string;
2626
azureOpenAIApiDeploymentName: string;
2727
}): string => {
28+
// Support both old (.openai.azure.com) and new (.cognitiveservices.azure.com) endpoint formats
29+
// If instanceName already includes a full domain, use it as-is
30+
if (azureOpenAIApiInstanceName.includes('.azure.com')) {
31+
return `https://${azureOpenAIApiInstanceName}/openai/deployments/${azureOpenAIApiDeploymentName}`;
32+
}
33+
// Legacy format for backward compatibility
2834
return `https://${azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${azureOpenAIApiDeploymentName}`;
2935
};
3036

0 commit comments

Comments
 (0)