Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
AzureSTT
Azure Cognitive Services Speech-to-Text provider. Streams audio to Azure Speech SDK for real-time transcription. Supports 100+ BCP-47 languages and optional phrase-list hints for domain-specific vocabulary boosting.Constructor
Azure Speech resource subscription key. Falls back to the
AZURE_SPEECH_KEY environment variable when omitted.Azure region identifier for the Speech resource (e.g.
"eastus", "westeurope", "southeastasia"). Falls back to the AZURE_REGION environment variable, then "eastus" as a hard default. Must match the region where your Azure Speech resource was created. Keys are region-scoped.BCP-47 locale tag for the spoken language. Defaults to
"en-US". Examples: "fr-FR", "de-DE", "zh-CN", "ja-JP", "pt-BR". Over 100 locales are supported; see the Azure Speech language-support docs for the full list.PCM input sample rate in Hz sent to Azure. Defaults to
16000.When
True, the phrases supplied in phrase_list are registered as recognition hints to improve accuracy for domain-specific terms. Defaults to False.List of words or phrases (strings) to use as recognition hints when
enable_phrase_list is True. Defaults to None.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.
AzureOpenAISTT
Azure OpenAI Whisper STT plugin. Transcribes audio via an Azure-hosted Whisper deployment, supporting optional streaming mode, ISO-639-1 language hints, and multiple output formats (JSON, VTT, SRT, plain text).Constructor
Azure OpenAI API key. Falls back to
AZURE_API_KEY then AZURE_OPENAI_API_KEY environment variables when omitted.Full Azure OpenAI resource endpoint URL, e.g.
"https://<resource>.openai.azure.com/". Falls back to the AZURE_OPENAI_ENDPOINT environment variable when omitted.Name of the Azure OpenAI deployment for the Whisper model. This is the custom name you chose when deploying the model in Azure portal or AI Foundry (not necessarily the same as the model name). Falls back to the
AZURE_OPENAI_STT_DEPLOYMENT environment variable. Accepts any AzureOpenAISTTModel enum value or a raw string. Defaults to None.Azure OpenAI REST API version string. Defaults to
"2025-03-01-preview". Use "2024-10-21" for the GA stable audio transcription release.Underlying model name passed in the request body, e.g.
"whisper-1". When a deployment name is already set, this field is typically left empty. Defaults to "".ISO-639-1 language code of the spoken audio, e.g.
"en", "fr", "de". Supplying the correct language improves transcription accuracy and reduces latency. Defaults to "en".When
True, receive transcription results as a streaming response. When False (default), the full transcript is returned in a single response.Sample rate (Hz) of the incoming audio, typically
48000. Defaults to 48000.Sample rate (Hz) used when forwarding audio to the Azure Whisper endpoint. Audio is resampled from
input_sample_rate to this value before transmission. Defaults to 24000.Optional text to guide the model’s transcription style or to continue context from a previous audio segment. Should be in the same language as the audio. Defaults to
None.Sampling temperature in
[0.0, 1.0] controlling transcription randomness. 0 makes sampling deterministic; the model auto-increases temperature if needed. Defaults to None (provider default of 0).Format of the transcription response. One of: *
"json" (default): {"text": "..."} * "verbose_json": full object with text, language, duration, and segments * "text": plain string * "srt": SubRip subtitle format * "vtt": WebVTT subtitle formatTurn-detection strategy for streaming mode. One of
"server_vad" (default, server-side voice activity detection) or "none" (no automatic turn detection).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.