Skip to navigation

Create speech

View as Markdown

Generates audio from text using the specified voice. Returns the complete audio file in the requested format. This is a non-streaming endpoint that waits for the entire audio to be generated before returning.

Set the format with output_format: the container (raw, wav or mp3), the encoding (pcm_f32le, pcm_s16le, pcm_mulaw or pcm_alaw) and the sample rate. The response carries X-Audio-Format, X-Audio-Sample-Rate and X-Audio-Channels. Without output_format, the response is a WAV file at 24 kHz. See Output Formats.

Authentication

X-API-Keystring

API key for authentication. Example: raya_ABCD1234567890abcdef

Request

This endpoint expects an object.
textstringRequired

The text to convert to speech.

Script notes:

  • Hindi (language: hi) must be in Devanagari script. Romanized Hindi is not supported.
  • For English (en-in, en-us), Indic named entities (names, places, etc.) are pronounced more accurately in Devanagari — e.g. राहुल instead of Rahul. If text is LLM-generated, prompt it to output Indic names in Devanagari even when the rest of the content is in English.
voice_idstringRequired

The ID of the voice to use for synthesis. Use /v1/voices to get available voice IDs. The voice_id must match the model you specify — standard voices only work with "model": "standard", and m1 voices only work with "model": "m1".

languageenumRequired

Language code for the text. Currently supported: hi (Hindi), mr (Marathi), te (Telugu), kn (Kannada), bn (Bengali), as (Assamese), gu (Gujarati), ne (Nepali), ml (Malayalam), ta (Tamil), en (English, used by m1 voices), en-in (Indian English), en-us (US English).

Hindi must be written in Devanagari script (Romanized Hindi is not supported). For English, Indic named entities are best written in Devanagari for accurate pronunciation. More languages are coming soon.

modelenumOptionalDefaults to standard

The synthesis model to use. Each model has its own set of voices — use /v1/voices to find voice IDs for the model you choose.

Important: standard and m1 voices are not interchangeable. Passing a standard voice ID with "model": "m1" (or vice versa) will fail.

Allowed values:
speedfloatOptionalDefaults to 1

Speech speed multiplier (0.5 to 1.5). Changes standard voices only; m1 voices ignore it.

output_formatobjectOptional

Encoding and sample rate of the audio chunks. Only the raw container is accepted on the WebSocket.

Response headers

Content-DispositionstringOptional

Names the download after the output_format container: tts_output.raw, tts_output.wav or tts_output.mp3.

X-Audio-FormatstringOptional

Only when output_format is sent. The encoding you asked for, or mp3.

X-Audio-Sample-RateintegerOptional

Only when output_format is sent, and not for mp3. The sample rate of the audio, in Hz.

X-Audio-ChannelsintegerOptional

Only when output_format is sent, and not for mp3. Always 1 (mono).

Response

Audio file generated successfully

Errors

400
Bad Request Error
404
Not Found Error
422
Unprocessable Entity Error
500
Internal Server Error