Neets.ai offers a variety of text-to-speech models available over a streaming HTTP API.
curl \
-X POST \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"text": "The quick brown fox jumps over the lazy dog.",
"voice_id": "us-male-2",
"params": {
"model": "style-diff-500"
}
}' \
https://api.neets.ai/v1/tts > neets_demo.mp3
import requests
import json
response = requests.request(
method="POST",
url="https://api.neets.ai/v1/tts",
headers={
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
json={
"text": "The quick brown fox jumps over the lazy dog.",
"voice_id": "us-male-2",
"params": {
"model": "style-diff-500"
}
}
)
with open("neets_demo.mp3", "wb") as f:
f.write(response.content)
const fs = require('fs');
const responsePromise = fetch(
'https://api.neets.ai/v1/tts',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'The quick brown fox jumps over the lazy dog.',
voice_id: 'us-male-2',
params: {
model: 'style-diff-500'
}
})
}
)
.then(response => response.arrayBuffer())
.then(buffer => {
fs.writeFileSync('neets_demo.mp3', Buffer.from(buffer));
});
fetch(
'https://api.neets.ai/v1/tts',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'The quick brown fox jumps over the lazy dog.',
voice_id: 'us-male-2',
params: {
model: 'style-diff-500'
}
})
}
)
.then(response => response.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
const audio = new Audio(url);
console.log('Playing audio.');
audio.play();
});
View the TTS API Reference for more information about available models and their parameters.