- Building the LiveKit custom STT provider class
# ask-ai
m
• Building the LiveKit custom STT provider class
t
Thanks for reaching out, Zeeshan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Here’s a friendly guide to help you build a custom STT provider class in LiveKit: 1. Start by inheriting from the base class: Extend the
stt.STT
class from the LiveKit Agents SDK to get things rolling. 2. Define the essentials: Make sure to implement the
label
property so your STT provider has a clear identity. 3. Set up capabilities: In your constructor, call
super()
with an
STTCapabilities
object that specifies support for
streaming
and
interimResults
. 4. Implement transcription methods: Override the
_recognize_impl
method for non-streaming transcription, and if you support streaming, don’t forget to override the
stream()
method too. 5. Handle provider-specific options: Pass things like API keys and model choices to your constructor, and be sure to validate them to keep everything running smoothly. 6. Create a custom
SpeechStream
class:
If streaming is part of your plan, this class will help you manage real-time transcription by processing audio frames and sending out transcription events. If you want to see some real-world examples or need a bit more guidance, check out the implementations for OpenAI, AssemblyAI, or ElevenLabs. And hey, if you have any questions or want a hand with anything, just let me know—I’m here to help! Sources: STT | LiveKit Agents | plugins/assemblyai/src/stt.ts | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/stt.py