Usage guide
Setup, environment variables, and Python/JavaScript/Go usage examples.
GoogleSTT
Google Cloud Speech-to-Text V2 plugin with streaming support. Uses Google Cloud Speech-to-Text V2 recognition models (latest_long by
default, plus the Chirp family). Supports live streaming, speaker diarization,
word-level timing, and per-utterance voice-activity events.
Constructor
Service-account credentials as a raw JSON string or a path to a JSON key file. Takes highest precedence for authentication.
Path to a service-account JSON key file. Used when
credentials_json is not provided.Google API key. Used as a fallback credential source if the above are absent; the value is treated as a JSON file path first. For STT, service-account auth is recommended over API keys.
Google Cloud project ID. Extracted automatically from the service-account JSON when not provided explicitly.
When
True (default), audio is transcribed over a low-latency streaming connection. When False, a single-request (batch) call is used.Cloud Speech-to-Text regional endpoint.
"us" (default) or "eu".BCP-47 language code(s) for recognition, e.g.
"en-US" (default) or ["en-US", "fr-FR"]. Multiple codes enable multi-language detection.Recognition model ID. Known values (
GoogleSTTModel): "latest_long" (default), "latest_short", "chirp_3", "chirp_2", "telephony", "telephony_short".Input audio sample rate in Hz. Default:
48000.Number of audio channels in the input. Default:
1 (mono).When
True (default), partial transcripts are emitted before an utterance is finalised.When
True (default), automatic punctuation is added to transcripts.When
True, profane words are replaced with placeholder characters. Default: False.When
True, spoken punctuation cues (e.g. “period”) are transcribed as punctuation marks. Default: False.When
True, spoken emoji names are transcribed as emoji characters. Default: False.When
True, start and end timestamps are returned for each recognised word. Default: False.When
True, per-word confidence scores are included in results. Default: False.Maximum number of alternative transcriptions to return. Default:
1.When
True, speech-start and speech-end events are emitted independently of transcripts. Default: False.Seconds to wait for speech to begin before a voice-activity timeout is triggered.
None uses the API default.Seconds of silence after speech before an end-of-speech voice-activity event is fired.
None uses the API default.Minimum expected number of speakers for diarization.
None disables diarization.Maximum expected number of speakers for diarization.
None disables diarization.Client-side filter; transcripts with a confidence score below this value are discarded. Range
0.0–1.0. Default: 0.0 (no filtering).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.