AUDIO
Last updated
Last updated
Endpoint:
https://api.hyprlab.io/v1/text:synthesize
curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer $HYPRLAB_API_KEY" \
--data '{
"input": {
"markup": "Let me take a look, [pause long] yes, I see it."
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Chirp3-HD-Aoede"
},
"audioConfig": {
"audioEncoding": "MP3"
}
}' "https://api.hyprlab.io/v1/text:synthesize" | \
jq -r '.audioContent' | base64 -d > output.mp3
const axios = require("axios");
const fs = require("fs");
// API endpoint and headers
const url = "https://api.hyprlab.io/v1/text:synthesize";
const headers = {
"Content-Type": "application/json",
Authorization: "Bearer $HYPRLAB_API_KEY",
};
// Request payload
const data = {
input: {
markup: "Let me take a look, [pause long] yes, I see it.",
},
voice: {
languageCode: "en-US",
name: "en-US-Chirp3-HD-Aoede",
},
audioConfig: {
audioEncoding: "MP3",
},
};
// Make the request
axios
.post(url, data, { headers })
.then((response) => {
// Extract base64 audio content and decode it
const audioContent = response.data.audioContent;
const audioBuffer = Buffer.from(audioContent, "base64");
// Save as MP3
fs.writeFileSync("output.mp3", audioBuffer);
console.log("Audio saved as output.mp3");
})
.catch((error) => {
console.error("Error:", error);
});
import requests
import base64
# API endpoint and headers
url = "https://api.hyprlab.io/v1/text:synthesize"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer $HYPRLAB_API_KEY"
}
# Request payload
data = {
"input": {
"markup": "Let me take a look, [pause long] yes, I see it."
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Chirp3-HD-Aoede"
},
"audioConfig": {
"audioEncoding": "MP3"
}
}
# Make the request
response = requests.post(url, json=data, headers=headers)
# Extract base64 audio content and decode it
audio_content = response.json()["audioContent"]
audio_data = base64.b64decode(audio_content)
# Save as MP3
with open("output.mp3", "wb") as f:
f.write(audio_data)
SEE MORE:
chirp-3
$20 / 1M Characters