Skip to main content
There is no Mirai plugin for LiveKit Agents yet. LiveKit’s OpenAI plugin can call our OpenAI-compatible speech endpoint instead, with one extra setting for the sample rate. This page was tested with LiveKit Agents 1.8.0 and livekit-plugins-openai 1.8.0.

1. Install

Create the key in the console under Developers. See Get a key.

2. Add it to your agent

The voices are ashu, neha, shruti and sameer (hear them). Once your company has gone live, use https://prod.voice.miraiminds.co/v1. The plugin assumes OpenAI’s PCM, which is 24 kHz. Ours is 48 kHz, so without the SAMPLE_RATE line LiveKit plays the audio at half speed and an octave too low. Set it before you create the TTS: the plugin reads it then, and again on every request.
The setting changes every OpenAI TTS in the process. SAMPLE_RATE belongs to LiveKit’s OpenAI plugin module, not to one TTS object. OpenAI’s own TTS sends 24 kHz PCM, and with this setting that audio plays at double speed. Run Mirai in a dedicated worker, and don’t mix it with OpenAI TTS in the same worker.
Each request the plugin makes is an ordinary request to POST /v1/audio/speech: billed per character, counted against your limits, and listed in your request log.

If you also use OpenAI TTS in the same worker

Leave out the SAMPLE_RATE line and ask for WAV:
A WAV file states its own sample rate, so it plays at the right speed. The cost is latency: WAV is not streamed. Each piece of audio arrives in one go once it has been synthesised, so the caller hears each sentence later than with pcm.

3. Check your connection

Download the runnable example and run it. It speaks one line through LiveKit’s OpenAI plugin and saves it as speech.wav. It needs only your Mirai key: no LiveKit room, microphone, STT or LLM key. It uses a little API credit.
Output
The script lists its dependencies inline, so uv run mirai_livekit.py works too, without the pip install. It reads the key from MIRA_API_KEY (or MIRAI_API_KEY). If it fails, look up the status code from the error in When something fails; a 401 means the key is wrong or missing.

TTS quickstart

Voices, formats, limits and the request log.

Pipecat

Our own Pipecat services, if you build on Pipecat instead.