Text to Speech · API

Generate speech

Turn text into speech and get the audio back.

POSThttps://api.audiclabs.com/v1/tts/speech

Request

Send JSON. Costs 1 credit per call. Needs the tts:speech scope.

modelstringrequired
Always audic-tts-1.
inputstringrequired
The text to speak.
voicestringrequired
A voice id from GET /voices, e.g. voice_bilal_en.
speednumberoptional
Optional. Speaking rate; 1.0 is normal.
languagestringoptional
Optional. A code from GET /languages. Defaults to the voice's language.
response_formatstringoptional
Optional. Audio format of the result. Default mp3.
streambooleanoptional
Optional. Default true: the MP3 is sent in pieces as it is generated, so playback can start after about a second. false returns the whole file at once. See Generate speech (streaming).

Example

curl -o hello.mp3 https://api.audiclabs.com/v1/tts/speech \
  -H "Authorization: Bearer $AUDICLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"audic-tts-1","input":"Hello from AudicLabs.","voice":"voice_bilal_en"}'

Response

200 with the audio as audio/mpeg. A short sentence takes about one to three seconds.

Errors use the standard format, see Errors. A missing or unknown model returns 400 or 404 with the accepted value in the message; an unknown voice returns 400.