Speech to Text — 음성을 텍스트로 변환
Speech to Text — 음성을 텍스트로 변환
OpenAI Audio API는 두 가지 음성 인식 엔드포인트를 제공해요: transcriptions(음성을 원래 언어로 텍스트화)와 translations(음성을 영어로 번역·텍스트화). 과거엔 오픈소스 whisper-1이 뒷받침했고, 이제 gpt-4o-transcribe, gpt-4o-mini-transcribe, gpt-4o-transcribe-diarize 같은 고품질 스냅샷도 지원해요.
주요 사용
- 음성을 포함하는 언어 그대로 텍스트로 전사
- 음성을 영어로 번역·전사
from openai import OpenAI
client = OpenAI()
audio_file = open("/path/to/file/speech.mp3", "rb")
transcription = client.audio.transcriptions.create(
model="gpt-4o-transcribe",
file=audio_file,
response_format="text",
)
print(transcription.text)
포맷 설정
response_format으로text,json,srt,vtt등 원하는 출력을 고를 수 있어요.- 모델별로 지원하는 기능(화자 라벨, 단어 타임스탬프, 자막 등)이 달라요.