Skip to navigation

Generate speech (TTS)

Turns text into spoken audio.

Send up to 2,000 characters with the language they are written in, optionally choosing a male or female voice, and receive one complete WAV file ready to play or store. Use it for assistant replies, notifications, IVR prompts and read-aloud features.

The generated audio is returned as a single WAV file containing 16-bit PCM samples in one channel, at the sample rate published in the catalog, which is 24 kHz today. Requests are charged by the number of input characters, at 100 characters per credit; the length of the generated audio does not affect the charge. For reference, the duration of the audio is reported in the X-Llynx-Audio-Duration-Ms response header.

The response body is the audio itself, not JSON. When testing with curl, add -o speech.wav to save it to a file.

Authentication

AuthorizationBearer

Your Llynx API key, sent as Authorization: Bearer <key>.

Request

This endpoint expects an object.
inputstringRequired1-2000 characters

The text to speak, up to 2,000 characters including spaces and punctuation. Whitespace-only text is rejected.

languagestringRequired<=63 characters

Language the text is written in, as a tag from the Languages page, for example hi or en.

response_formatenumRequired

Audio container. Only wav is available.

Allowed values:
genderenumOptionalDefaults to male
Voice gender for the generated audio.
Allowed values:

Response headers

X-Request-IDstringOptional
X-Llynx-LanguagestringOptional
X-Llynx-GenderstringOptional
X-Llynx-Audio-Duration-MsstringOptional
X-Llynx-Input-CharactersstringOptional
X-Llynx-Credits-ReservedstringOptional
X-Llynx-Capabilities-RevisionstringOptional
Version of the language catalog in force for this request.

Response

Complete WAV audio; the credit reserved for the request is reported in headers

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
413
Content Too Large Error
415
Unsupported Media Type Error
422
Unprocessable Entity Error
429
Too Many Requests Error
503
Service Unavailable Error