Skip to main content
POST
Text to speech

Authorizations

Authorization
string
header
required

Your workspace secret key, sk_live_ followed by 32 hex characters. Create one in the console under Developers.

Body

application/json

OpenAI's audio/speech shape; fields an OpenAI SDK sends that this API does not use (instructions) are ignored.

bitrate
default:128

kbps, for mp3, opus and aac only ("128k" is accepted). Without it, the most the codec carries at a low rate when that is under 128 (mp3 at 8 kHz: 64).

Available options:
32,
48,
64,
96,
128,
160,
192
input
string

The text to speak.

Minimum string length: 1
language
string

Optional. The input's language, where its script cannot tell: Marathi (mr) is written in Devanagari like Hindi. Marathi text is recognised by its words, and sending mr makes it certain (hi keeps a line Hindi). Every other language is read from its script, and a language the script contradicts is ignored. One of hi, en, gu, mr, bn, ta, te, kn, ml, pa, od, a region allowed (mr-IN), or the language's English name (Marathi); anything else is ignored.

loudness
default:1

Linear gain (2.0 is +6 dB), held under full scale by a limiter.

Required range: 0.5 <= x <= 2
model
string
default:mira-tts
pace
default:1

Another name for speed (send one, or the same value in both).

Required range: 0.5 <= x <= 2
pitch
default:0

Pitch shift in semitones, without changing the tempo.

Required range: -6 <= x <= 6
response_format
string
default:pcm

pcm, wav, mulaw (ulaw), alaw, mp3, opus, aac or flac; or pcm_, mulaw_, alaw_, mp3_, opus_. The compressed formats are HTTP-only and need an encoder on the server (503 format_unavailable otherwise).

sample_rate
enum<integer>

Output rate. Default 48000 (8000 for mulaw/alaw). mulaw/alaw: 8000 or 16000; opus: 8000, 16000, 24000 or 48000.

Available options:
8000,
16000,
22050,
24000,
44100,
48000
speed
default:1

Tempo, without changing the pitch: 0.5 is half as fast, 2.0 twice as fast.

Required range: 0.5 <= x <= 2
text
string

Another name for input.

voice
string
default:shruti

A built-in voice, or the id (cv_...) of one of your own custom voices (GET /v2/custom-voices).

Response

Audio/wav