moses

Moses STT and TTS for LiveKit Agents: the livekit-plugins-moses plugin

livekit-plugins-moses adds Moses realtime speech to text and text to speech to LiveKit Agents: pooled, warmed-up connections and first audio in 0.13 s. Code included.

LiveKit Agents is the framework many commercial teams use to put voice agents into rooms, apps and phone calls: an AgentSession wires speech to text, an LLM and text to speech together, and LiveKit handles media, turn detection and interruptions. Today we’re releasing livekit-plugins-moses, which brings the Moses STT and Moses TTS APIs to it as plugins. Here is how to use it and what it does for you.

Install

pip install livekit-plugins-moses

Create a key with the TTS and STT scopes in the API console and set it as MOSES_API_KEY; the plugin reads it from there unless you pass api_key. New accounts get trial credit. The plugin is tested with LiveKit Agents 1.9 and released under Apache 2.0, like LiveKit Agents.

The agent

Pass the two plugins to an AgentSession, next to the VAD and LLM you already use:

from livekit.agents import Agent, AgentServer, AgentSession, JobContext, cli
from livekit.plugins import moses, openai, silero


class Assistant(Agent):
    def __init__(self) -> None:
        super().__init__(instructions=(
            "You are a helpful assistant in a voice conversation. Your answers are spoken, "
            "so keep them short and avoid lists or formatting."))

    async def on_enter(self) -> None:
        self.session.generate_reply(instructions="Greet the user briefly and offer your help.")


server = AgentServer()


@server.rtc_session()
async def entrypoint(ctx: JobContext) -> None:
    session = AgentSession(
        vad=silero.VAD.load(),
        stt=moses.STT(language="de"),                     # None detects the language
        llm=openai.LLM(model="gpt-4.1-mini"),
        tts=moses.TTS(voice="german/juergen", language="de"),
    )
    await session.start(agent=Assistant(), room=ctx.room)


if __name__ == "__main__":
    cli.run_app(server)

What the plugin does for you

  • Streaming STT with speech events. moses.STT streams the room audio to wss://moses-ai.com/stt/realtime and emits partial transcripts, start and end of speech, and finals. When the session’s turn handling decides the user is done, it flushes the stream, and the final arrives about 0.12 s later (measured from Germany, network included).
  • Streaming TTS. moses.TTS passes the LLM’s text to wss://moses-ai.com/tts/realtime as it is generated. The server cuts clauses and sentences itself, and first audio comes back about 0.13 s after the first text.
  • Pooled, warmed-up connections. TTS connections are kept in a pool, and each one reserves a voice worker and loads the voice when it opens. The next answer starts without a new handshake and without a cold start. Our latency guide explains why that matters.
  • Interruptions. When the user talks over the agent, LiveKit stops the answer. The plugin drops that connection, which stops the speech on the server so no stale audio follows, and warms up a fresh one in the background for the next answer.
  • Whole texts and recordings, too. tts.synthesize() speaks a whole text and stt.recognize() transcribes a whole recording, for greetings, voicemail or post-call work.
  • Sensible failures. A wrong key, a missing scope or no credit raises a non-retryable error. If a speech server goes away mid-call, the plugin reconnects by itself.

Try it in the terminal

The example agent runs in LiveKit’s console mode, so you can talk to it through your microphone without a LiveKit server:

git clone https://github.com/mosesplatform/livekit-plugins-moses && cd livekit-plugins-moses
pip install -e . "livekit-agents[openai,silero]~=1.9" python-dotenv
cp env.example .env                  # MOSES_API_KEY, OPENAI_API_KEY
python examples/agent.py console     # talk in the terminal
python examples/agent.py dev         # or join a LiveKit room (LIVEKIT_* in .env)

Set MOSES_LANGUAGE=de and MOSES_VOICE=german/juergen to talk German.

Languages and voices

  • Speech to text: 25 European languages (bg, cs, da, de, el, en, es, et, fi, fr, hr, hu, it, lt, lv, mt, nl, pl, pt, ro, ru, sk, sl, sv, uk), detected automatically when language is None.
  • Text to speech: English, German, French, Italian, Portuguese, Spanish and Dutch, with 27 built-in voices.
  • Your own voice: clone one through the API from a short recording, then use moses.TTS(voice="clone:anna").
  • Changing mid-session: stt.update_options(language="en") applies to open streams at once; tts.update_options(voice=...) applies from the next answer.

Before production

  • Capacity. Each agent session uses one STT stream and one TTS connection. Accounts start with two of each at once; ask Support before launch and we raise it for your account.
  • A server key. Your agent workers call Moses from a few IP addresses. Mark the key as a server key in the console, so the per-IP limit meant for keys in apps doesn’t apply.
  • Privacy. Audio, text and transcripts are processed in Germany and not stored; only the amounts are recorded, for billing.
  • Cost. Prepaid credit, per character of speech and per second of audio transcribed, no subscription; see pricing.

Settings, limits and the changelog are on the LiveKit docs page, and the source is on GitHub. Using Pipecat as well? The same APIs come as pipecat-moses.

Frequently asked questions

Does Moses work with LiveKit Agents?

Yes. The livekit-plugins-moses package on PyPI provides moses.STT and moses.TTS for LiveKit Agents 1.x. Pass them to an AgentSession together with any LLM and VAD.

How fast is the Moses LiveKit plugin?

Measured from Germany with network included, the final transcript arrives about 0.12 s after the agent's turn handling flushes the stream, and the first audio about 0.13 s after the first text from the LLM.

Can I test the agent without a LiveKit server?

Yes. The example agent runs in console mode (python examples/agent.py console): you talk to it through your computer's microphone and speakers in the terminal, without a LiveKit server or room.

Can I use LiveKit's OpenAI plugin with Moses instead?

Yes. openai.TTS and openai.STT work with base_url set to https://moses-ai.com/tts/v1 or /stt/v1. The Moses plugin is faster because it streams over the realtime WebSockets and pools warmed-up connections.

Which languages does the Moses LiveKit plugin support?

Speech to text: 25 European languages with automatic detection. Text to speech: English, German, French, Italian, Portuguese, Spanish and Dutch, with 27 built-in voices and your own cloned voices.

Try the realtime voice APIs

Streaming speech to text and text to speech for voice agents, hosted in Germany, with no audio stored. Try both in your browser with an API key.

Open the live example