Text
The Text To Speech OpenAI (TTS) API allows you to convert text into high-quality, natural-sounding speech. You can use this API to generate voiceovers for multimedia content, create narrations for e-books and documents, or turn subtitles into engaging audio experiences.
Text To Speech
POST https://api.ttsopenai.com/uapi/v1/text-to-speech
This endpoint allows you to convert text into speech. You can customize the voice, speed, and model used for the conversion.
Example Request
curl -X POST https://api.ttsopenai.com/uapi/v1/text-to-speech \
-H "Content-Type: application/json" \
-H "x-api-key: <your api key>" \
-d '{
"model": "tts-1",
"voice_id": "OA001",
"speed": 1,
"input": "Hello, my name is OpenAI. I am a text-to-speech model."
}'
Request Attributes
model
string
The model used for the conversion. You can choose between tts-1
and tts-1-hd
. The default value is tts-1
.
voice_id
string
The voice used for the conversion. You can find the list of voice IDs in the Voice Library. The default value is OA001
.
speed
float
The speed of the speech. The value should be between 1 and 4. The default value is 1.
input
string
The text to be converted into speech. The maximum length is 10,000 characters.
Example Response
{
"success": true,
"result": {
"uuid": "eef94c08-a806-11ef-b617-22023a24db09",
"voice_id": "OA001",
"speed": 1,
"model": "tts-1",
"tts_input": "Hello, my name is OpenAI. I am a text-to-speech model.",
"estimated_credit": 54,
"used_credit": 54,
"status": 1,
"status_percentage": 50,
"error_message": "",
"speaker_name": "Alloy",
"created_at": "2024-11-21T12:48:40",
"updated_at": "2024-11-21T12:48:40"
}
}
Response Attributes
success
boolean
Indicates whether the request was successful.
result
object
The result of the text-to-speech conversion.
result.uuid
string
The unique identifier for the conversion.
result.voice_id
string
The voice used for the conversion.
result.speed
float
The speed of the speech.
result.model
string
The model used for the conversion.
result.tts_input
string
The text that was converted into speech.
result.estimated_credit
integer
The estimated number of credits used for the conversion.
result.used_credit
integer
The actual number of credits used for the conversion.
result.status
integer
The status of the conversion. Possible values are:
1
: Converting2
: Completed3
: Error11
: Reworking12
: Joining Audio13
: Merging Audio14
: Downloading Audio
result.status_percentage
integer
The percentage of the conversion that has been completed.
result.error_message
string
The error message, if any.
result.speaker_name
string
The name of the speaker.
result.created_at
string
The date and time when the conversion was created.
result.updated_at
string
The date and time when the conversion was last updated.