const options = {
method: 'POST',
headers: {'X-API-Key-ID': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'नमस्ते, आप कैसे हैं?',
speaker_embedding: {
embedding: '<base64-encoded embedding>',
shape: [1, 768],
dtype: 'torch.bfloat16'
},
audio_config: {
sample_rate: 44100,
num_channels: 1,
sample_width: 2,
encoding: 'linear_pcm',
container: 'wav'
}
})
};
fetch('https://api.vachana.ai/api/v1/tts/inference', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));