Amazon Transcribe
Amazon Transcribe
Amazon Transcribe의 패스스루 엔드포인트를 소개할게요. 배치(batch) 및 관리 API — 전사 작업 시작·폴링·삭제, 커스텀 어휘(vocabulary), 어휘 필터, 언어 모델, Call Analytics 카테고리 관리 등을 네이티브 AWS 형식 그대로(변환 없이) 호출할 수 있는 기능이에요.
출처: 문서
본문
StartTranscriptionJob 같은 작업은 transcribe/StartTranscriptionJob 형식으로 기록되며, 전사 작업 요청은 transcribe/{Operation} 패턴으로 로그돼요. 참고로 스트리밍(StartStreamTranscription, transcribestreaming)은 지원되지 않아요.
연결 대상 호스트는 다음과 같아요.
https://transcribe.{aws_region_name}.amazonaws.com
프록시를 통한 주소는 이렇게 구성돼요.
LITELLM_PROXY_BASE_URL/transcribe
빠른 시작 (Quick Start)
먼저 AWS 자격 증명을 설정하고, S3 버킷 접근 권한(transcribe:*)을 준비해요.
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_REGION_NAME="us-west-2"
config.yaml에 transcribe_media_buckets를 지정해 미디어 버킷을 제한할 수 있어요.
general_settings:
transcribe_media_buckets:
- my-bucket
그다음 LiteLLM 프록시를 실행해요.
litellm --config config.yaml
# RUNNING on http://0.0.0.0:4000
이제 전사 작업을 시작해요.
curl -X POST 'http://0.0.0.0:4000/transcribe/StartTranscriptionJob' \
-H "Authorization: Bearer ***" \
-H 'Content-Type: application/json' \
-d '{
"TranscriptionJobName": "my-job",
"LanguageCode": "en-US",
"MediaFormat": "wav",
"Media": {"MediaFileUri": "s3://my-bucket/audio.wav"}
}'
작업 상태는 GetTranscriptionJob으로 폴링하고, 완료되면 TranscriptFileUri(전사 결과 파일)를 받을 수 있어요.
curl -X POST 'http://0.0.0.0:4000/transcribe/GetTranscriptionJob' \
-H "Authorization: Bearer ***" \
-H 'Content-Type: application/json' \
-d '{"TranscriptionJobName": "my-job"}'
지원되는 작업은 StartTranscriptionJob, GetTranscriptionJob, ListTranscriptionJobs, DeleteTranscriptionJob, CreateVocabulary 등이 있어요. 전체 목록은 Amazon Transcribe API 작업 문서를 참고해 주세요. 참고로 StartMedicalTranscriptionJob, StartMedicalScribeJob, StartCallAnalyticsJob도 지원됩니다.
AWS SDK (boto3)와 함께 사용하기
boto3 클라이언트의 endpoint_url을 LITELLM_PROXY_BASE_URL/transcribe로 바꾸면 돼요. AWS SDK는 X-Amz-Target 헤더를 사용하므로, LiteLLM 키를 aws_access_key_id 자리에 넣어 전달합니다.
import boto3
client = boto3.client(
"transcribe",
region_name="us-west-2",
endpoint_url="http://0.0.0.0:4000/transcribe",
aws_access_key_id="sk-<your-litellm-api-key>",
aws_secret_access_key="placeholder",
)
client.start_transcription_job(
TranscriptionJobName="my-job",
LanguageCode="en-US",
MediaFormat="wav",
Media={"MediaFileUri": "s3://my-bucket/audio.wav"},
)
job = client.get_transcription_job(TranscriptionJobName="my-job")["TranscriptionJob"]
print(job["TranscriptionJobStatus"])
이 경우 LiteLLM 키는 Credential= 형식으로 전달돼요.
비용 추적과 예산 (Cost Tracking and Budgets)
비용은 StartTranscriptionJob으로 작업이 제출된 뒤, GetTranscriptionJob으로 상태를 폴링해 작업이 COMPLETED 또는 FAILED 상태가 되면 input_cost_per_second(초당 비용)에 기반해 transcribe/StartTranscriptionJob 모델로 계산돼요.
max_budget을 설정하면 작업 상태가FAILED가 되기 전에도 예산 초과 시 경고할 수 있어요.GetTranscriptionJob,ListTranscriptionJobs같은 관리 작업은 비용이0으로 기록되고, 요청 자체는transcribe/{Operation}으로 로그돼요.
접근 제어는 rpm_limit(분당 요청 제한), allowed_routes(/transcribe), 그리고 StartTranscriptionJob 계열 작업의 ContentRedaction, ToxicityDetection, ModelSettings.LanguageModelName, LanguageIdSettings.<language>.LanguageModelName 같은 파라미터로 세밀하게 설정할 수 있어요.
지원 미디어 형식: StartTranscriptionJob은 flac, mp3, ogg, wav 형식과 MediaFormat(및 Media.MediaFileUri)을 지원해요. mp4, m4a, webm, amr 형식은 지원되지 않아 MediaFormat 관련 오류가 발생할 수 있어요.
접근 제어 (Access Control)
/transcribe 라우트에 대한 접근 제어가 가능해요. 요청의 Media.MediaFileUri, OutputBucketName이 general_settings.transcribe_media_buckets에 허용된 버킷인지 검사합니다. DataAccessRoleArn(및 JobExecutionSettings)을 쓸 때도 config.yaml의 transcribe_media_buckets 목록이 적용돼요.
StartTranscriptionJob,GetTranscriptionJob,DeleteTranscriptionJob은litellm-owner역할이 필요할 수 있어요.ListTranscriptionJobs는 별도 권한으로 제어할 수 있어요.
제약 사항 (Limitations)
- 스트리밍 API(
transcribestreaming.{region}.amazonaws.com)는 지원되지 않아요. 배치(transcribe.{region}.amazonaws.com)만 지원합니다. TranscriptFileUri로 결과 파일을 가져오려면s3:GetObject권한이 필요해요.Media.MediaFileUri는 S3 경로여야 하며, HTTP URL은 지원되지 않아요.