Skip to main content
Save the following code as somya_livekit.py beside the agent.py from the LiveKit quickstart. These adapters call the SomyaLabs HTTP API; they are example code for your agent project, not a published plugin.

How the adapter works

SomyaSTT uploads a complete WAV utterance to POST /v1/speech/transcriptions. Its predicted_lang becomes the LiveKit transcript language. LiveKit’s VAD waits for the end of speech before each ASR request, so interim transcripts are not available. SomyaTTS sends text and a voice slug to POST /v1/speech/synthesize and reads the newline-delimited JSON response. Each chunk_b64 is a self-contained 24 kHz mono WAV. The adapter extracts PCM audio for LiveKit. The final record contains the full utterance, so it is skipped when earlier chunks were played. Keep the SomyaLabs API key on the agent server. See Authentication, ASR, and TTS for the HTTP API details.