Text-to-Speech (TTS)
Convert text into speech.​
Converts text into speech using a text-to-speech (TTS) model, useful for creating audio outputs from textual inputs for applications like voice assistants or accessibility tools.
Example​
JavaScript
const fs = require('fs');
const path = require('path');
const axios = require('axios').default;
const api = new axios.create({
baseURL: 'https://api.umamiai.xyz/v1',
headers: { Authorization: 'Bearer YOUR_UMAMIAI_API_KEY>' },
});
const main = async () => {
const response = await api.post(
'/tts',
{
model: '#g1_aura-asteria-en',
text: 'Hi! What are you doing today?',
},
{ responseType: 'stream' },
);
const dist = path.resolve(__dirname, './audio.wav');
const writeStream = fs.createWriteStream(dist);
response.data.pipe(writeStream);
writeStream.on('close', () => console.log('Audio saved to:', dist));
};
main();
Python
import os
import requests
def main():
url = "https://api.umamiai.xyz/v1/tts"
headers = {
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY>",
}
payload = {
"model": "#g1_aura-asteria-en",
"text": "Hi! What are you doing today?",
}
response = requests.post(url, headers=headers, json=payload, stream=True)
dist = os.path.join(os.path.dirname(__file__), "audio.wav")
with open(dist, "wb") as write_stream:
for chunk in response.iter_content(chunk_size=8192):
if chunk:
write_stream.write(chunk)
print("Audio saved to:", dist)
main()
path=/tts
method=post
Request
JavaScript
const response = await fetch('https://api.umamiai.xyz/v1/tts', {
method: 'POST',
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_UMAMIAI_API_KEY"
},
body: JSON.stringify({
"model": "text",
"text": "text"
}),
});
const data = await response.json();
Python
import requests
response = requests.post(
"https://api.umamiai.xyz/v1/tts",
headers={"Content-Type":"application/json","Authorization": "Bearer YOUR_UMAMIAI_API_KEY"},
json={"model":"text","text":"text"}
)
data = response.json()
Curl
curl -L \
-X POST \
-H 'Authorization: Bearer YOUR_UMAMIAI_API_KEY'
-H 'Content-Type: application/json' \
'https://api.umamiai.xyz/v1/tts' \
-d '{"model":"text","text":"text"}'