1const key = 'YOUR_API_KEY';
2
3const requestData = {
4  request: {
5    voice_id: 'James',
6    language: 'en-US',
7    texts: [
8      'To be or not to be, that is a question.'
9    ],
10    volume: 1.2,
11    speed: 1.2
12  }
13};
14
15fetch('https://api.novita.ai/v3/async/txt2speech', {
16  method: 'POST',
17  headers: {
18    'Authorization': `Bearer ${key}`,
19    'Content-Type': 'application/json'
20  },
21  body: JSON.stringify(requestData)
22})
23.then(response => response.json())
24.then(data => {
25  console.log(data);
26})
27.catch(error => {
28  console.error('Error:', error);
29});
30