LiveKit
Transcribe user audio or hold a live conversation in a LiveKit Agents session with Sprag models.
Overview
Sprag provides an OpenAI compatible API allowing you to run LiveKit Agents on our models out of the box. Set our base URL on LiveKit's OpenAI plugin and invoke one of our models.
Installation
Install LiveKit Agents with the OpenAI extra:
uv add "livekit-agents[openai]"Then set your Sprag API key as an environment variable:
export SPRAG_API_KEY=<your_sprag_api_key>You can generate a key from API keys in the Sprag app, or start with the quickstart if you do not have an account yet.
Connection
Pass our base URL and your API key when you construct the service.
| Argument | Value |
|---|---|
base_url | https://api.sprag.ai/v1 |
api_key | Your Sprag API key |
One base URL covers both REST and realtime.
Services
Speech to text. Transcribe user audio with
openai.STT over REST or a realtime websocket.
Realtime LLM. openai.realtime.RealtimeModel
replaces separate STT, LLM, and TTS stages with one WebSocket.
Choosing between them
Use speech to text for transcription only, feeding your own LLM and TTS. Use realtime LLM when the agent should listen and speak in one hop, with no separate STT or TTS call.
If you would rather not wire up separate transcription, LLM, and speech stages at all, our realtime API offers a single multimodal model that listens and speaks, with no LiveKit room or agent framework in between.