This is the voice our agents use, offered as a standalone API. It speaks
OpenAI’s
POST /v1/audio/speech protocol, so every OpenAI SDK and every
framework with an OpenAI TTS integration can already call it. You change the
base URL and the model name, and the rest of your code stays as it is.
To hear the voices and see how the model scores, read the
Mira TTS model page. To see
how its price compares with other Hindi TTS APIs, read our
Hindi TTS API comparison.
1. Get a key
Open Developers in the sandbox console and press Create key. You do not need an access code. The first time, the console asks for your work email and sends you a confirmation link; open it, then press Create key again. The key is ask_live_ secret, and the
console shows it only once. We store only its hash, so we cannot
recover a lost key; you rotate it instead. The same key works for TTS and the
rest of the v2 API, and draws on the same wallet.
2. One request
--output: without it, curl
prints 300 KB of binary into your terminal and you have to reset it. If
speech.wav plays, the integration works, and the sections below refine it.
Output formats
Pick the format and sample rate your player or phone line uses, and we convert on our side as the audio streams:
Send the rate in
sample_rate, or use a value with the rate built in:
If
response_format includes a rate, leave sample_rate out or send the same
value; a different one returns a 400. For a WAV at another rate, send wav
with sample_rate, for example "sample_rate": 16000. Values are not case
sensitive.
Any other value returns a 400 whose message lists the values we accept.
OpenAI’s default format, mp3, works here. If you omit response_format you
still get pcm at 48 kHz, so send it explicitly.
Compressed formats are for HTTP requests. The
WebSocket endpoint streams pcm, μ-law and A-law only. If
our server cannot encode a compressed format, the request returns
503 format_unavailable and nothing is charged. GET /v1/models lists the
compressed formats only when they are available.
Phone-ready audio: 8 kHz μ-law
ffplay -f mulaw -ar 8000 speech.ulaw.
Compressed audio: MP3 at 64 kbps
"response_format": "mp3_44100_64" asks for the same thing in one field.
Speed, pitch and loudness
Three optional fields change how the voice sounds. All three work on/v1/audio/speech and /v2/tts, and on the
WebSocket endpoint.
sample_rate used to be ignored. If your code already sends it, check the
value: a supported rate such as 16000 now gets you audio at that rate
instead of 48 kHz, and an unsupported one such as 32000 returns a 400 that
lists the allowed rates.model is mira-tts. Any other value returns a 404; older names that still
work are listed under Compatibility.
Pick a voice
ashu, neha, shruti, sameer, munshi and tanvi.
ashu, neha, shruti and sameer are Hindi voices that code-switch into
English the way real Indian speech does. munshi and tanvi speak Hindi,
English, Gujarati, Tamil and Telugu. shruti is the default if you omit
voice. Each entry gives the voice_id, the voice’s
name and its language. To hear a voice before you choose, use the voice picker
in the console’s Agent Studio. An unknown voice returns a 400 that names the
allowed set; we never swap in another voice silently. Your own
custom voices work here too: send a voice’s id
(cv_…) as voice. The price is the same as for a built-in voice. Gujarati, Tamil and
Telugu are live too: send the text in its own script and the same voices read
it, with no language parameter. Kannada, Malayalam and Bengali work the same
way, in beta, on all six voices. Marathi is in beta too and needs one field;
see Marathi below. The language roadmap has
the details.
Marathi
Marathi is written in Devanagari, like Hindi, so its script alone doesn’t say which one it is. Its words do: a line with Marathi words such as आहे, नाही or तुमच्या is read as Marathi without anything extra. A very short line with no Marathi word in it (“धन्यवाद”) is read as Hindi. Add"language": "mr" to make
every line Marathi:
language is optional, and today it matters only for Devanagari: mr makes a
line Marathi and hi keeps it Hindi. It also takes mr-IN or Marathi. Every
other language is read from its script, so a language that disagrees with
the text is ignored: Hindi text sent with "language": "kn" is still read as
Hindi. A value we don’t recognise is ignored too, and never fails the request.
With the OpenAI SDK, pass it as extra_body={"language": "mr"}. The
streaming socket has no language field yet, so there
Marathi is recognised by its words alone, sentence by sentence.
What comes back
Every200 carries its own accounting in headers, so you can meter spend and
pin a build without a second request:
Read
X-Sample-Rate and X-Audio-Encoding before you play the audio. Raw
audio has no header, so playing μ-law as PCM, or 8 kHz audio as 48 kHz, gives
you noise or audio at the wrong speed.
Every error after authentication also carries X-Request-Id, so you can trace
a failure the same way as a success. Quote the id when you ask us about a
failed request.
3. Stream it
pcm, μ-law, A-law and the compressed formats stream: the first bytes arrive while the rest is still
being synthesised. With the OpenAI SDK, read them as they come:
sample_rate is not an OpenAI parameter. To get another rate through the SDK,
pass it in extra_body={"sample_rate": 16000}.
To save the stream as a playable file, write the PCM into a WAV with Python’s
own wave module. You need no other audio package:
4. Pipecat
If you build on Pipecat, use our integration. Install it withuv add pipecat-mirai and add MiraiTTSService to your pipeline:
https://sandbox.voice.miraiminds.co/v1 with model mira-tts
and response_format="pcm". The audio is 48 kHz unless you ask for another
rate, and X-Sample-Rate always tells you which rate you got. On LiveKit
Agents, the OpenAI plugin needs one setting for that rate; see
LiveKit.
For phone calls
Four things keep a phone call’s audio smooth.Ask for the line’s format
Phone audio is 8 kHz. Request it from us and forward each chunk to your provider as it arrives, base64-encoded into the provider’s media message, with no decoding or resampling on your side:Keep one connection open
Opening a new HTTPS connection for every sentence adds a TCP and TLS handshake before that sentence can start: 0.4 to 1 second from India, and more when a connection attempt has to be retried. Use the WebSocket endpoint, which carries the whole call on one socket. If you stay on HTTP, reuse one keep-alive client (onehttpx.AsyncClient or
requests.Session) for every request in the call.
Keep the provider 0.4 seconds ahead
If you send audio to the phone line at exactly real time, the provider holds only the latest chunk, about 40 ms of audio. Any stall on your server longer than that (a blocking call, a long JSON parse, many calls on one CPU) leaves the line silent and the caller hears the voice break up. Send audio as it arrives until the provider holds about 0.4 seconds more than the caller has heard, then pace it. When the caller interrupts, tell the provider to drop what it holds (Twilioclear, Plivo clearAudio, Exotel clear). The phone
bridge example shows the pattern for
Twilio. On Pipecat, pipecat-mirai (0.3.1 and later) does it for you
(recommended phone setup).
Buffer the start of each sentence
Hold about 150 ms of audio before a sentence starts playing. Its first chunk can be short and followed by a brief pause. If playback starts on it, the caller hears a sliver of a word, a gap, then the rest.Why the format matters
Each stream needs its audio to arrive at least as fast as it plays. The bandwidth one stream needs, before network overhead:
At 48 kHz, six calls already need a steady 4.6 Mbit/s of download. On an
ordinary server link that can fall behind real time, and the calls start to
break up. 8 kHz μ-law needs a twelfth of that, and a narrowband phone line
carries no more than 8 kHz anyway.
With all four in place, using pipecat-mirai’s
MiraiTTSService, we ran 12 and
then 16 simultaneous phone calls through our API to the speech engine: 235 and
262 conversational turns, about a fifth of them interrupted by the caller.
Every call played with no audible gaps and no errors, and every sentence
arrived in order. We then repeated the 12-call run against this production
API from a client in Europe: 194 turns, again no gaps, no errors and every
sentence in order, with first audio at the phone (from the LLM’s first token)
at 622 ms median and 737 ms at the 95th percentile. The test
harness
is public, so you can run it yourself.
Billing
HTTP: ₹1.80 per 1,000 characters. WebSocket: ₹0.90 per minute connected. Top-ups use the same rates. On the text-to-speech WebSocket you pay for time, not text: every second the socket is open is billed at the per-minute rate, and the speech it carries is not charged again by the character. HTTP requests are billed by the character.
Shared endpoint. No contractual SLA. Monthly commitments are credited to your wallet. Unused credit never expires. All prices exclude GST.
Enterprise: Custom volume pricing, concurrency, dedicated endpoint and SLA. Top up anytime at the same rate.
Over HTTP, each request is rounded up to the paisa, and we charge only for
completed audio. If the engine fails, the stream stalls or your client
disconnects part-way, nothing is charged and no ledger row is written. The request still
appears in your log, with a status that says why. The output format, sample
rate, bitrate, speed, pitch and loudness do not change the price.
On the WebSocket endpoint you pay for the time
the socket is open, ₹0.90 a minute counted per second, and not for the
characters it speaks. Each full minute is one wallet row, and the last
part-minute is charged when the socket closes.
The charge is one debit row on the same wallet your calls draw
from, and it appears on the console billing statement under Text to speech:
GET /v2/wallet/transactions
If your wallet cannot cover the request, you get a
402 before anything is
synthesised. See Wallet.
Limits
We refuse an HTTP request over the limit instead of queueing it. Honour
Retry-After and send it again. A refused request does not hold a slot and
costs nothing. at_capacity can also come from a deployment-wide ceiling when
the speech node is saturated. Handle it the same way.
Sentences on the WebSocket endpoint draw on the same
limit, but a sentence that finds it full waits up to 3 seconds for a slot
before it fails. A live conversation rides out a short burst there without a
retry loop of your own.
The limit is set per workspace, and a workspace starts at 10. The plans under
Billing list the concurrency each plan includes. If your
workspace’s limit doesn’t match your plan, or you need more,
ask us. Changing the limit is a provisioning change and needs no change to
your code.
Your request log
We log every request, whether it completed, failed or was rejected, and you can read the log yourself.200 OK
GET /v2/tts/requests/{id} returns a single row. The id is the
X-Request-Id you got back from the request.
We do not keep the text you send.
preview is the first 48 characters of
input, so a row is recognisable in a list. The rest is never stored.When something fails
Errors use the same envelope as the rest of the API. See
Errors. If you are stuck on something this page does not cover,
reply on your onboarding thread, where a person reads it.
Fixing choppy or broken audio
If callers hear gaps, clicks or a voice that breaks up, find the symptom below.
To find out whether a gap starts on our side or yours, look the request up in
your request log.
first_byte_ms is how long we took to
send the first audio, and status says whether all of it was delivered. If
those look normal and the caller still hears gaps, the audio is being held up
between our server and the caller: on your link, in your server’s event loop,
or in how it is paced to the phone line. The fixes above cover each of those.
If you are on Pipecat, the recommended phone setup
takes care of all of this except the size of your limit.