For the complete documentation index, see llms.txt. This page is also available as Markdown.

Text to Speech

Generate Speech (Text-to-Speech)

post

Generates audio from input text using text-to-speech (TTS) models. The response is a JSON object containing base64-encoded audio in the audios array (not a raw binary stream).

Only model and input are required. All other parameters are model-specific — for example sarvam/bulbul:v2 supports target_language_code, speaker, pitch, pace, loudness, speech_sample_rate, enable_preprocessing, output_audio_codec, temperature, and enable_cached_responses.

Tip: Supported parameters and their accepted values differ from one model to another. Call GET /api/v1/models and inspect each model's supported_parameters and supported_params_details to see exactly which fields it accepts and the allowed values, ranges, or enums.

Authorizations
AuthorizationstringRequired

FastRouter API Key. Get yours at https://fastrouter.ai

Format: Authorization: Bearer YOUR_API_KEY

Body
modelstringRequired

TTS model in provider/model format.

Example: sarvam/bulbul:v2
inputstringRequired

The text to convert to speech.

Example: The quick brown fox.
target_language_codestringOptional

Model-specific (e.g. Sarvam). BCP-47 language code of the output speech (e.g. en-IN, hi-IN).

Example: en-IN
speakerstringOptional

Model-specific (e.g. Sarvam). The speaker voice to use.

Example: anushka
pitchnumberOptional

Model-specific (e.g. Sarvam). Adjusts the pitch of the generated speech.

pacenumberOptional

Model-specific (e.g. Sarvam). Adjusts the speed of the speech (e.g. 0.5x to 2.0x).

Example: 1
loudnessnumberOptional

Model-specific (e.g. Sarvam). Adjusts the loudness of the generated speech.

speech_sample_rateintegerOptional

Model-specific (e.g. Sarvam). Output audio sample rate in Hz.

Example: 22050
enable_preprocessingbooleanOptional

Model-specific (e.g. Sarvam). Enables text normalization / preprocessing before synthesis.

output_audio_codecstringOptional

Model-specific (e.g. Sarvam). The audio codec/format of the response.

temperaturenumberOptional

Model-specific. Sampling temperature for generation.

enable_cached_responsesbooleanOptional

Model-specific (e.g. Sarvam). Allows returning a cached response for identical requests.

Responses
200

The generated speech. Returns a JSON object containing the base64-encoded audio (not a raw binary stream).

application/json
audiosstring[]Optional

Array of base64-encoded audio clips (WAV). Usually one entry.

modelstringOptional

The model used to generate the audio.

Example: sarvam/bulbul:v2
providerstringOptional

The upstream provider that served the request.

Example: sarvam
post/api/v1/audio/speech

Last updated