The Text-to-Speech API allows you to convert text into speech using various voice models. It provides both GET and POST endpoints for generating audio output.
http://localhost:8080/
Converts the provided text into speech using the specified voice model.
POST /api/tts
The request body should be a JSON object with the following properties:
text
(string, required): The text to be converted into speech.voice
(string, optional): The voice model to be used for speech synthesis. If not provided, the default voice model will be used.
{
"text": "Hello, world!",
"voice": "en-us-libritts-low.onnx"
}
- Status Code: 200 (OK)
- Content-Type: audio/wav
The response will be an audio file in WAV format containing the synthesized speech.
HTTP/1.1 200 OK
Content-Type: audio/wav
Content-Length: <file_size>
<binary audio data>
Converts the provided text into speech using the specified voice model.
GET /api/tts?text=<text>&voice=<voice>
text
(string, required): The text to be converted into speech.voice
(string, optional): The voice model to be used for speech synthesis. If not provided, the default voice model will be used.
- Status Code: 200 (OK)
- Content-Type: audio/wav
The response will be an audio file in WAV format containing the synthesized speech.
HTTP/1.1 200 OK
Content-Type: audio/wav
Content-Length: <file_size>
<binary audio data>
Retrieves a list of available voice models that can be used for speech synthesis.
GET /api/voices
- Status Code: 200 (OK)
- Content-Type: application/json
The response will be a JSON array containing the names of available voice models.
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: <response_size>
[
"en-us-libritts-high.onnx",
"en-us-libritts-low.onnx",
...
]
In case of errors, the API will return an appropriate HTTP status code along with an error message in the response body.
- Status Code: 400 (Bad Request)
- Content-Type: text/plain
HTTP/1.1 400 Bad Request
Content-Type: text/plain
Error parsing JSON: Invalid request body
- Status Code: 500 (Internal Server Error)
- Content-Type: text/plain
HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
Error running executable: Failed to start speech synthesis process