Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
OpenAISTT
Streaming speech-to-text via OpenAI’s transcription API. Uses thegpt-4o-transcribe family (or whisper-1) with server-side VAD turn
detection and optional input noise reduction.
Constructor
OpenAI API key. Falls back to
OPENAI_API_KEY.Transcription model:
gpt-4o-transcribe, gpt-4o-mini-transcribe, gpt-4o-transcribe-diarize or whisper-1. Default "gpt-4o-transcribe".ISO-639-1 language code (e.g.
"en"). Default "en".Stream partial transcripts as the caller speaks. Default True.
Input rate in Hz. Default 48000.
Resampled rate sent to the model in Hz. Default 24000.
Optional text prompt to bias vocabulary/style.
VAD mode:
"server_vad" or "semantic_vad". Default "server_vad".Speech-detection sensitivity, 0.0–1.0. Default None.
Audio kept before detected speech, in ms. Default None.
Silence before end-of-turn, in ms. Default None.
Input denoising profile:
"near_field", "far_field" or None to disable. Default "near_field".Transcript format (
"json", "text", …). Default "json".Override the OpenAI API base URL.
aclose
emit
The event to emit.
off
The event the handler was registered for.
The handler to remove.
on
callback is omitted.
The event to listen for.
The handler to invoke when the event is emitted. If
None, a decorator is returned that registers the decorated function.The registered callback when
callback is provided, otherwise a decorator that registers and returns the function it wraps.on_stt_transcript
An async callable that receives each
STTResponse.process_audio
Raw audio bytes to transcribe.
Optional language code to guide recognition.
stream_transcribe
An async iterator yielding raw audio byte chunks.
STTResponse: Transcription events produced as audio is consumed.