C.W.K.
Stream
Lesson 04 of 05 · published

Audio APIs — TTS, 전사, Realtime

~22 min · audio, tts, transcription

Level 0Tokenizer
0 XP0/54 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

OpenAI 의 audio surface 셋 — TTS (gpt-4o-mini-tts, 텍스트 → 오디오), 전사 (gpt-4o-transcribe, 오디오 → 텍스트), Realtime (websocket, full-duplex 저지연 voice agent).

TTS — text-to-speech

client.audio.speech.create(model='gpt-4o-mini-tts', voice='nova', input='...'). MP3/Opus/WAV 출력. Voice 여러 옵션 — 캐릭터 톤 매칭에 사용.

전사 — speech-to-text

client.audio.transcriptions.create(model='gpt-4o-transcribe', file=...). WAV/MP3/M4A 등 입력. Word-level timestamp 옵션 — caption, search 에 활용.

Realtime — voice agent

Voice-in/voice-out 실시간 경험은 realtime websocket. 한 번의 connection 에 audio in 과 audio out 동시 — TTS + STT 분리보다 latency 낮아.

cwkPippa 가 어떤 TTS 쓰는지

cwkPippa 는 ElevenLabs (Joanne voice) 를 default — gpt-4o-mini-tts 보다 prosody 가 풍부. MD5 cache 로 같은 line 재생성 안 해. OpenAI TTS 는 ElevenLabs-quality 안 필요할 때 right default.

Code

TTS with gpt-4o-mini-tts·python
# Classic Whisper
with open("recording.mp3", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="whisper-1",
        file=audio_file,
        language="en",
        response_format="text",  # "text", "json", "srt", "vtt"
    )
print(transcript.text)

# GPT-4o powered (more accurate)
with open("recording.mp3", "rb") as audio_file:
    transcript = client.audio.transcriptions.create(
        model="gpt-4o-transcribe",
        file=audio_file,
    )
전사 with gpt-4o-transcribe·python
response = client.audio.speech.create(
    model="tts-1",             # "tts-1", "tts-1-hd", "gpt-4o-mini-tts"
    voice="alloy",             # "alloy", "echo", "fable", "onyx", "nova", "shimmer"
    input="Hello! Welcome to our service.",
    response_format="mp3",     # "mp3", "opus", "aac", "flac", "wav", "pcm"
    speed=1.0,                 # 0.25 – 4.0
)

with open("speech.mp3", "wb") as f:
    f.write(response.content)

External links

Exercise

'Speak this answer' flow build — text → gpt-4o-mini-tts MP3 → 저장. 그 다음 reverse: MP3 → gpt-4o-transcribe → text. Paragraph round-trip + 보존된 부분 측정.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.