Skip to main content

/tts (Start TTS)

This is the main endpoint for creating new text-to-speech tasks.

When you send a request, the API validates your inputs and queues the generation task. Because this process is asynchronous, the endpoint immediately returns a generation_id upon success.

You must then use this ID to poll the Status Endpoint to retrieve your audio URL once it's ready.


Base URL

https://api.audixa.ai/v2

Request

POST /tts


Request Body

All parameters are sent as a JSON object in the request body.

ParameterTypeRequiredDescription
textstringYesThe text you want to convert to speech. Must be at least 30 characters.
voicestringYesThe Voice ID to use for generation. See the Voice Library for all available IDs.
modelstringNoThe model to use. Can be "base" or "advance". Defaults to "base".
speednumberNoPlayback speed. Can range from 0.5 to 2.0. Defaults to 1.0.

Advance Model Parameters

These parameters are only used if you set "model": "advance". They will be ignored by the Base model. See our Models Guide for details.

ParameterTypeDefaultDescription
emotionstring"neutral"The emotion to apply. Valid options: "neutral", "happy", "sad", "angry", "surprised".
temperaturenumber0.9Controls randomness. Lower values are more deterministic. Range: 0.7 to 0.9.
top_pnumber0.9Nucleus sampling. Range: 0.7 to 0.98.
do_samplebooleanfalseSet to true to enable sampling for more varied outputs.

Code Examples

curl -X POST "https://api.audixa.ai/v2/tts" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Welcome to Audixa AI, your affordable and powerful text-to-speech solution.",
"voice": "am_ethan",
"model": "base",
"speed": 1.1
}'

Responses

✅ Success

A successful request will return a 201 Created status code along with the unique ID for your generation task.

Response: 201 Created
{
"generation_id": "base_27b4695b-017f-4b6e-8121-03264624479c"
}

❌ Errors

This endpoint will return standard HTTP error codes:

Status CodeError CodeDescription
400 Bad RequestInvalid voice IDThe voice ID you sent does not exist.
400 Bad RequestInvalid EmotionYou sent an emotion not in the allowed list for the Advance model.
400 Bad RequestText must be...Your text input was too short.
401 UnauthorizedInvalid API KeyYour x-api-key is missing or incorrect.
402 Payment RequiredInsufficient BalanceYour account does not have enough credits to perform this generation.
403 ForbiddenThis voice is...Your plan does not have access to this premium voice.

Next Steps

Once you have your generation_id, you must poll the Get Status Endpoint to check on the progress and retrieve your audio file.