Text-to-Speech (TTS) Service User Guide¶
Welcome! This guide will help you quickly get started with the Language Server Text-to-Speech (TTS) API. You’ll learn how to convert text into speech using a simple API call, understand the required parameters, and see example requests and responses.
Supported Providers: Azure, Google, Sarvam, and Open Source (Indic-Parler)
Quickstart¶
- Get your API key from your admin or dashboard.
- Choose your provider (Azure, Google, Sarvam, or Karya Local).
- Prepare your text and language code (see supported languages below).
- Send a POST request to the TTS endpoint with the required headers and form data.
- Download your audio from the response URLs.
1. Request Headers¶
Include these headers in every request:
Accept: application/json
X-API-Key: YOUR_API_KEY # Replace with your actual API key
Content-Type: multipart/form-data
2. Request Body: Form Data¶
Send the request body as multipart/form-data with a field named payload_data (see below for structure).
Synchronous TTS:
The synchronous endpoint processes your text in real time and returns audio URLs in the response.
3. Endpoint¶
- URL:
https://language-server-url/v1/task/text-to-speech - Method:
POST
4. Example Request (cURL)¶
curl -X POST 'https://language-server-url/v1/task/text-to-speech' \
-H 'accept: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: multipart/form-data' \
-F 'payload_data={
"user_email": "your_email@example.com",
"project_name": "Individual",
"provider": "AZURE",
"models": ["NEURAL"],
"task_name": "my_first_tts_task_unique_001",
"datapoints": {
"datapoint 1": {"text": "नमस्ते, यह एक परीक्षण है।", "speed": "1.0x", "lang": "hi-IN"}
}
}'
5. payload_data Structure¶
This is a JSON string containing your task and datapoints. Example:
{
"user_email": "your_email@example.com",
"project_name": "your_project_name",
"task_name": "my_first_tts_task_unique_001",
"provider": "AZURE",
"models": ["NEURAL"],
"datapoints": {
"datapoint 1": {
"text": "नमस्ते, यह एक परीक्षण है।",
"speed": "1.0x",
"lang": "hi-IN"
},
"datapoint 2": {
"text": "This is a test for English audio generation.",
"speed": "1.2x",
"lang": "en-IN"
}
}
}
Important: The
modelsfield is mandatory. It must be a non-empty list of model names (e.g.,["default"]). Omitting this field or leaving it empty will result in an error.
You can add as many datapoints as you need.
Required Fields in payload_data¶
| Field | Description | Type |
|---|---|---|
user_email |
Your registered email address | string |
project_name |
Name of your project | string |
task_name |
A unique name for the task (must not be reused) | string |
provider |
Backend provider (see table below) | string |
models |
Required. List of model names to use (e.g., ["NEURAL"]). |
list of strings |
datapoints |
Dictionary of datapoint objects. Each key (e.g., "datapoint 1") is a unique identifier. |
dict |
Provider & Model Mapping¶
| Provider | provider value |
Required models value |
Notes |
|---|---|---|---|
| Azure | "AZURE" |
["NEURAL"] |
Commercial. Only the model name NEURAL is supported. |
"GOOGLE" |
["WAVENET"] or ["STANDARD"] |
Commercial. Use ["WAVENET"] for premium, ["STANDARD"] for basic. |
|
| Sarvam | "SARVAM" |
["BULBULV2"] |
Commercial. Only BULBULV2 is supported. |
| Karya Local (Indic-Parler) | "KARYA_LOCAL" |
["INDIC_PARLER"] |
Open Source. Only INDIC_PARLER is supported. |
Tip: For personal use, set
project_nameto"Individual".
Available Models for Each Provider¶
Azure¶
Set models to ["neural"] (the only supported model for Azure TTS).
Google¶
Set models to either ["WAVENET"] (premium) or ["STANDARD"] (basic).
Sarvam¶
Set models to ["BULBULV2"] (the only supported model).
Karya Local (Indic-Parler)¶
Set models to ["INDIC_PARLER"] (the only supported model).
Warning: Leaving
modelsas["default"]or omitting it will not work. You must specify the correct model for your provider as shown above.Note: - If a model exists but is currently unserviceable (e.g., due to downtime or errors), the system will fall back to the most basic model for that provider.
Each datapoint must include:
| Field | Description | Type |
|---|---|---|
text |
Text to convert to speech | string |
speed |
Playback speed (e.g., "1.0x", "1.2x") |
string |
lang |
Language code (see below) | string |
About the models Field¶
- The
modelsfield is required for all TTS requests. - It must be a non-empty list of model names. For most providers, use
["NEURAL"]. - If you omit this field or provide an empty list, your request will be rejected.
- The available model names may vary by provider. See the Provider & Model Mapping table above for details.
Supported Languages¶
| Language | Code |
|---|---|
| Assamese | as-IN |
| Bengali | bn-IN |
| English (India) | en-IN |
| Gujarati | gu-IN |
| Hindi | hi-IN |
| Kannada | kn-IN |
| Malayalam | ml-IN |
| Marathi | mr-IN |
| Odia | or-IN |
| Punjabi | pa-IN |
| Tamil | ta-IN |
| Telugu | te-IN |
| Urdu | ur-IN |
Note: Not all providers support every language above.
6. Example Response¶
On success, you’ll get a JSON response with audio URLs:
{
"task_id": "your_task_id",
"status": "COMPLETED",
"result": {
"user_email": "your_email@example.com",
"project_name": "your_project_name",
"task_name": "my_first_tts_task_unique_001",
"provider": "AZURE",
"models": ["NEURAL"],
"datapoints": {
"datapoint 1": {
"text": "नमस्ते, यह एक परीक्षण है।",
"speed": "1.0x",
"lang": "hi-IN",
"saas_url": "https://<storage_account_name>.blob.core.windows.net/audio-output1/..."
}
}
}
}
Field Descriptions:
| Field | Description |
|---|---|
task_id |
Unique task identifier |
status |
Task status (PENDING, COMPLETED, FAILED) |
saas_url |
Temporary download link for the audio file |
Warning: Download your audio files within 24 hours. Links expire after that.
7. Response & Error Codes¶
| Code | Description |
|---|---|
| 200 | Request successful |
| 404 | Missing or invalid parameters |
| 500 | Internal server error |