Text Generator > Text-to-Speech Demo
Custom Text-to-Speech Demo
Enter text, select voice, choose speed, and click "Generate Speech".
1.0
Code Examples
cURL
curl -X POST "https://api.text-generator.io/api/v1/generate_speech" \
-H "Content-Type: application/json" \
-H "secret: YOUR_API_KEY" \
-d '{
"text": "Hello world",
"voice": "af_nicole",
"speed": 1.0
}'
JavaScript
const response = await fetch('https://api.text-generator.io/api/v1/generate_speech', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'secret': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'Hello world',
voice: 'af_nicole',
speed: 1.0
})
});
Python
import requests
import json
url = "https://api.text-generator.io/api/v1/generate_speech"
headers = {
"Content-Type": "application/json",
"secret": "YOUR_API_KEY"
}
data = {
"text": "Hello world",
"voice": "af_nicole",
"speed": 1.0
}
response = requests.post(url, headers=headers, json=data)