Metadata-Version: 2.5
Name: livekit-plugins-moses
Version: 0.1.0
Summary: Moses realtime speech-to-text (25 European languages) and text-to-speech for LiveKit Agents: hosted in Germany, nothing stored.
Project-URL: Homepage, https://moses-ai.com/tts_stt/livekit.html
Project-URL: Documentation, https://moses-ai.com/tts_stt/livekit.html
Project-URL: Pricing, https://moses-ai.com/pricing
Project-URL: Repository, https://github.com/mosesplatform/livekit-plugins-moses
Project-URL: Changelog, https://github.com/mosesplatform/livekit-plugins-moses/blob/main/CHANGELOG.md
Author: Moses AI
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: agents,european,gdpr,german,livekit,moses,realtime,speech-to-text,stt,text-to-speech,tts,voice agent
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.9
Requires-Dist: livekit-agents<2,>=1.9.0
Description-Content-Type: text/markdown

# livekit-plugins-moses

[Moses](https://moses-ai.com) realtime speech-to-text and text-to-speech for
[LiveKit Agents](https://github.com/livekit/agents).

- **Speech-to-text** in 25 European languages: partial transcripts while the user speaks, and the final as soon as
  the agent's turn handling ends the turn (the plugin supports `manual_flush`).
- **Text-to-speech** in 7 languages (English, German, French, Italian, Portuguese, Spanish, Dutch), with 27
  built-in voices or your own recorded voice. The LLM's text streams in as it is generated; the first audio of an
  answer starts after the first clause.
- **Hosted in Germany, nothing stored:** audio, text and transcripts are processed in memory and dropped. Only the
  amount (seconds of audio, characters) is recorded for billing. Prepaid credit, no subscription.

Maintained by Moses AI, the company behind the service.

## Installation

```bash
pip install livekit-plugins-moses
```

Get an API key with the **TTS** and **STT** scopes at [moses-ai.com/console](https://moses-ai.com/console) (new
accounts come with trial credit) and set it as `MOSES_API_KEY`.

## Usage

```python
from livekit.agents import AgentSession
from livekit.plugins import moses, openai, silero

session = AgentSession(
    vad=silero.VAD.load(),
    stt=moses.STT(language="de"),                          # or None to detect the language
    llm=openai.LLM(model="gpt-4.1-mini"),
    tts=moses.TTS(voice="german/juergen", language="de"),
)
```

### `moses.STT`

| Argument | Default | |
|---|---|---|
| `api_key` | `MOSES_API_KEY` | Key with the STT scope |
| `language` | `None` (detect) | `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`. Set it when you know it: short utterances are then decoded again in that language if they come out as English. |
| `endpoint_ms` | server default (300) | The server's own end-of-utterance pause, 100–3000 ms |
| `interim_results` | `True` | Partial transcripts |
| `base_url` | `https://moses-ai.com` | |

`stt.update_options(language=..., endpoint_ms=...)` applies to open streams without reconnecting.
`stt.recognize(buffer)` transcribes a whole recording through the file endpoint.

### `moses.TTS`

| Argument | Default | |
|---|---|---|
| `api_key` | `MOSES_API_KEY` | Key with the TTS scope |
| `voice` | `alba` | English: `alba`, `anna`, `vera`, `marius`, `jean`, … (21 voices); `german/juergen`, `french/estelle`, `italian/giovanni`, `portuguese/rafael`, `spanish/lola`, `dutch/daan`; your own voice: `clone:<name>`. List: `GET https://moses-ai.com/tts/v1/voices` |
| `language` | the voice's | `en de fr it pt es nl`. With `clone:<name>`, your voice speaks that language |
| `first_chunk_chars` | 30 | Minimum length before the first segment may be cut at a comma |
| `warmup` | `True` | Reserve a voice worker when a connection opens, for the fastest first audio |
| `base_url` | `https://moses-ai.com` | |

Audio is 24 kHz mono PCM. Connections are pooled: the next answer reuses the warm connection; an interrupted
answer's connection is closed and a fresh one is opened in the background.

## Running the example

`examples/agent.py` is a complete voice agent (Moses STT and TTS, an OpenAI LLM, Silero VAD):

```bash
pip install livekit-plugins-moses "livekit-agents[openai,silero]~=1.9" python-dotenv
cp env.example .env                 # MOSES_API_KEY, OPENAI_API_KEY
python examples/agent.py console    # talk to it in the terminal
python examples/agent.py dev        # or in a LiveKit room (LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET)
```

`MOSES_LANGUAGE=de MOSES_VOICE=german/juergen python examples/agent.py console` talks German.

## Latency

Measured from Germany, network included:
- STT: the final transcript arrives about 0.12 s after the stream is flushed.
- TTS: the first audio arrives about 0.13 s after the first text.

## Limits and errors

- Per account at once: 2 STT streams and 2 TTS connections by default (ask for more).
- A wrong key, a key without the needed scope, or no credit raises a non-retryable error. A lost worker or a full
  server is retried by the framework.
- `revision` events (a final decoded again in the set language) are logged, not emitted.

## Compatibility

Tested with LiveKit Agents 1.9.0. Python 3.10+.

## Links

- [Pricing](https://moses-ai.com/pricing) · [STT API](https://moses-ai.com/stt/) · [TTS API](https://moses-ai.com/tts/)
- Changelog: [CHANGELOG.md](CHANGELOG.md)

## License

Apache 2.0, see [LICENSE](LICENSE).
