Azure AI Speech
Azure AI Speech
Azure AI Speech 패스스루 엔드포인트를 소개할게요. Azure AI Speech의 음성 인식(speech to text) 기능인 짧은 오디오 REST 인식 엔드포인트와 배치 전사(batch transcription) REST API를 네이티브 Azure 형식 그대로(변환 없이) 호출할 수 있어요. 이건 Cognitive Services 음성 서비스로, LiteLLM이 /v1/audio/transcriptions로 제공하는 Azure OpenAI Whisper나 gpt-4o-transcribe와는 다른 서비스라는 점을 꼭 구분해 주세요.
출처: 문서
본문
모델명은 azure/speech/azure-stt를 쓰고, 가격 정보는 model_prices_and_context_window.json에 정의돼 있어요. 비용은 0으로 설정되어 있어요. 혹시 문제가 있다면 이슈 등록으로 알려주세요.
연결 대상 호스트는 다음과 같아요.
https://{region}.stt.speech.microsoft.com
https://{region}.api.cognitive.microsoft.com
프록시를 통한 주소는 이렇게 구성돼요.
LITELLM_PROXY_BASE_URL/azure_speech
인증은 Ocp-Apim-Subscription-Key 또는 Authorization: Bearer ***를 사용해요.
빠른 시작 (Quick Start)
환경 변수를 설정해요. AZURE_SPEECH_API_KEY와 AZURE_SPEECH_REGION을 지정합니다.
export AZURE_SPEECH_API_KEY=""
export AZURE_SPEECH_REGION="swedencentral"
AZURE_SPEECH_REGION이 설정되어 있으면 AZURE_SPEECH_API_BASE는 자동으로 결정돼요. 그다음 LiteLLM 프록시를 실행해요.
litellm
# RUNNING on http://0.0.0.0:4000
이제 짧은 오디오 REST 인식 엔드포인트를 호출해 볼게요.
curl -X POST 'http://0.0.0.0:4000/azure_speech/speech/recognition/conversation/cognitiveservices/v1?language=en-US&format=detailed' \
-H "Authorization: Bearer ***" \
-H 'Content-Type: audio/wav; codecs=audio/pcm; samplerate=16000' \
--data-binary @audio.wav
응답은 다음과 같아요.
{"RecognitionStatus":"Success","Offset":9700000,"Duration":89500000,"DisplayText":"Britain Tranquility Base. Here the eagle has landed."}
또는 실시간(real-time) 전사 API를 호출할 수 있어요.
curl -X POST 'http://0.0.0.0:4000/azure_speech/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
-H "Authorization: Bearer ***" \
-F '[email protected]' \
-F 'definition={"locales":["en-US"]};type=application/json'
응답은 다음과 같아요.
{"durationMilliseconds":5061,"combinedPhrases":[{"text":"Listen, Tranquility Base here. The Eagle has landed."}],"phrases":[...]}
배치 전사(batch transcription) API도 호출할 수 있어요. 작업을 만들고, 조회하는 흐름입니다.
curl -X POST 'http://0.0.0.0:4000/azure_speech/speechtotext/v3.2/transcriptions' \
-H "Authorization: Bearer ***" \
-H 'Content-Type: application/json' \
-d '{
"displayName": "my-job",
"locale": "en-US",
"contentUrls": ["https://example.blob.core.windows.net/audio/recording.wav?<sas>"]
}'
curl 'http://0.0.0.0:4000/azure_speech/speechtotext/v3.2/transcriptions?top=10' \
-H "Authorization: Bearer ***"
엔드포인트 패밀리와 호스트 (Endpoint Families and Hosts)
짧은 오디오 REST 인식 호출은 /azure_speech/speech/ 경로로 시작하며, 내부적으로 /speech/recognition/conversation/cognitiveservices/v1로 전달되고 호스트는 https://{AZURE_SPEECH_REGION}.stt.speech.microsoft.com을 써요.
배치 전사 호출은 /azure_speech/speechtotext/ 경로로 시작하며, /speechtotext/v3.2/transcriptions, /files 같은 하위 경로로 전달되고 호스트는 https://{AZURE_SPEECH_REGION}.api.cognitive.microsoft.com을 써요. Content-Type, Accept 같은 헤더도 그대로 전달돼요.
참고로 /azure_speech/ 외의 경로에 대해서는 짧은 오디오 REST와 배치 전사 문서를 참고해 주세요. 인증은 Ocp-Apim-Subscription-Key 또는 Authorization: Bearer ***를 사용합니다.
제약 사항 (Limitations)
다음 항목들은 아직 지원되지 않아요.
- 스트리밍/웹소켓 인식 —
wss://{region}.stt.speech.microsoft.com같은 실시간 웹소켓 인증(Authorization: Bearer ***)은 지원하지 않아요. - 타임스탬프 필드 — 응답의
Offset,Duration,durationMilliseconds같은 필드는 실제 값으로 변환되지 않아요. 모델azure/speech/azure-stt의 가격이model_prices_and_context_window.json에0으로 지정돼 있어서, 표준/v1/audio/transcriptions처럼 비용 추적/시간 계산을 하지 않아요. - 일부 응답 필드 손실 —
Duration,RecognitionStatus: NoMatch같은 특정 응답 필드는 그대로 전달되지 않을 수 있어요. - 배치 전사 일부 메서드 —
/speechtotext/v3.2/...경로에서POST,PUT,GET,PATCH,DELETE메서드가 모두 지원되지는 않아요.azure_speech/batch-transcription모델은 가격이0으로 등록되어 있어요.