🗣️Text To Speech
OpenAI's realistic text to speech model
TTS Models
GET
/tts/list
List available TTS Models
Headers
Name
Value
Content-Type
application/json
Response
["tts-1", "tts-1-hd", ...]
TTS Voices
GET
/tts/voices
List available TTS Voices
Headers
Name
Value
Content-Type
application/json
Response
["alloy", "echo", "fable", ...]
Create Speech
POST
/tts/:model
Headers
Name
Value
Content-Type
application/json
Authorization
Bearer <token>
Body
Name
Type
Description
Default
input
string
Input text
none
voice
string
Voice
alloy
speed
number
Voice speed (0.25 - 4.0)
1.0
Response
{
"data": "d2VsbF9oZWxsb190aGVyZV90Lm1lL3N5bmFwc2VfbGFicw....."
}
Example
const res = await fetch('https://synapselabs.onrender.com/tts/tts-1-hd', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_api_key>'
},
body: JSON.stringify({
input: 'hello',
speed: 1.0,
voice: 'alloy',
}),
});
const data = await res.json();
const buf = Buffer.from(data.data, 'base64');
fs.writeFileSync('test.mp3', buf);
Last updated