Assistant Endpoints
AI Voice Assistant
Get Started
Frequently Asked Questions
Creating with Soundverse
Exploring Soundverse
Account Management
Developer APIs
Assistant Endpoints
Assistant Endpoints
AI Voice Assistant
🎙️ Real-Time AI Voice & Response Generation
Use this API to interact with our AI voice assistant in real time. Simply provide your userId
and speech_url
to receive an AI-generated voice response as a streamed audio file.
Core Parameters
🛈 The parameters below define the request body for this API.
Parameter | Type | Required? | Description |
---|---|---|---|
speech_url | string | ✅ Required | URL pointing to the input audio file |
Request Body
Request body:
{
"speech_url": "https://example.com/your_audio.mp3"
}
Code Samples
<input type="text" id="userId" value="user-123">
<input type="text" id="speechUrl" value="https://example.com/speech.mp3">
<button id="playButton">Play Voice</button>
<audio id="audioPlayer" controls></audio>
<script>
async function getVoiceAudio() {
const userId = document.getElementById("userId").value;
const speechUrl = document.getElementById("speechUrl").value;
const response = await fetch("https://api.soundverse.ai/v1/assistant/voice", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer your_api_key_here"
},
body: JSON.stringify({ speech_url: speechUrl }),
});
if (!response.ok || !response.body) {
throw new Error("Failed to fetch audio");
}
const reader = response.body.getReader();
const chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
}
const blob = new Blob(chunks, { type: "audio/mpeg" });
const url = URL.createObjectURL(blob);
const audio = document.getElementById("audioPlayer");
audio.src = url;
audio.play();
}
document.getElementById("playButton").addEventListener("click", getVoiceAudio);
</script>
<input type="text" id="userId" value="user-123">
<input type="text" id="speechUrl" value="https://example.com/speech.mp3">
<button id="playButton">Play Voice</button>
<audio id="audioPlayer" controls></audio>
<script>
async function getVoiceAudio() {
const userId = document.getElementById("userId").value;
const speechUrl = document.getElementById("speechUrl").value;
const response = await fetch("https://api.soundverse.ai/v1/assistant/voice", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer your_api_key_here"
},
body: JSON.stringify({ speech_url: speechUrl }),
});
if (!response.ok || !response.body) {
throw new Error("Failed to fetch audio");
}
const reader = response.body.getReader();
const chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
}
const blob = new Blob(chunks, { type: "audio/mpeg" });
const url = URL.createObjectURL(blob);
const audio = document.getElementById("audioPlayer");
audio.src = url;
audio.play();
}
document.getElementById("playButton").addEventListener("click", getVoiceAudio);
</script>
curl -X POST "https://api.soundverse.ai/v1/assistant/voice" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"speech_url": "https://example.com/your_audio.mp3"
}'
Response
If the request is valid, you’ll receive an audio data in chunks.
Response
HTTP/1.1 200 OK
Content-Type: audio/mpeg
HTTP/1.1 200 OK
Content-Type: audio/mpeg
{
"success": false,
"message": "Invalid request body"
}
Possible Errors :
- Internal Server Error -
500 status code