AUDIO
🔊 Gemini TTS Model
Making Request:
Endpoint:
https://api.hyprlab.io/v1beta/models/[MODEL]:generateContent?key=[API-KEY]Single-Speaker Example:
#!/bin/bash
set -e -E
HYPRLAB_API_KEY="$HYPRLAB_API_KEY"
MODEL_ID="gemini-2.5-flash-preview-tts"
curl -X POST \
-H "Content-Type: application/json" \
"https://api.hyprlab.io/v1beta/models/${MODEL_ID}:generateContent?key=${HYPRLAB_API_KEY}" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Greet the user in a warm and welcoming voice: Good morning! Ready to start your day?"
}
]
}
],
"generationConfig": {
"responseModalities": ["audio"],
"temperature": 1,
"speech_config": {
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Zephyr"
}
}
}
}
}' > output.json
echo "Response saved as output.json"const axios = require("axios");
const fs = require("fs");
// API endpoint and headers
const modelId = "gemini-2.5-flash-preview-tts";
const url = `https://api.hyprlab.io/v1beta/models/${modelId}:generateContent?key=${process.env.HYPRLAB_API_KEY}`;
const headers = {
"Content-Type": "application/json",
};
// Request payload
const data = {
contents: [
{
role: "user",
parts: [
{
text: "Greet the user in a warm and welcoming voice: Good morning! Ready to start your day?",
},
],
},
],
generationConfig: {
responseModalities: ["audio"],
temperature: 1,
speech_config: {
voice_config: {
prebuilt_voice_config: {
voice_name: "Zephyr",
},
},
},
},
};
// Make the request
axios
.post(url, data, { headers })
.then((response) => {
// Save the full JSON response to output.json
fs.writeFileSync("output.json", JSON.stringify(response.data, null, 2));
console.log("Response saved as output.json");
})
.catch((error) => {
console.error("Error:", error.response ? error.response.data : error.message);
});import requests
import json
import os
# API endpoint and headers
model_id = "gemini-2.5-flash-preview-tts"
url = f"https://api.hyprlab.io/v1beta/models/{model_id}:generateContent?key={os.getenv('HYPRLAB_API_KEY')}"
headers = {
"Content-Type": "application/json",
}
# Request payload
data = {
"contents": [
{
"role": "user",
"parts": [
{
"text": "Greet the user in a warm and welcoming voice: Good morning! Ready to start your day?"
}
]
}
],
"generationConfig": {
"responseModalities": ["audio"],
"temperature": 1,
"speech_config": {
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Zephyr"
}
}
}
}
}
# Make the request
response = requests.post(url, json=data, headers=headers)
# Save the full JSON response to output.json
with open("output.json", "w") as f:
json.dump(response.json(), f, indent=2)
print("Response saved as output.json")Multiple-Speaker Example:
#!/bin/bash
set -e -E
HYPRLAB_API_KEY="$HYPRLAB_API_KEY"
MODEL_ID="gemini-2.5-flash-preview-tts"
curl -X POST \
-H "Content-Type: application/json" \
"https://api.hyprlab.io/v1beta/models/${MODEL_ID}:generateContent?key=${HYPRLAB_API_KEY}" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Read aloud in a warm, welcoming tone\nSpeaker 1: Hello! We are excited to show you our native speech capabilities.\nSpeaker 2: Where you can direct a voice, create realistic dialog, and so much more. Edit these placeholders to get started."
}
]
}
],
"generationConfig": {
"responseModalities": ["audio"],
"temperature": 1,
"speech_config": {
"multi_speaker_voice_config": {
"speaker_voice_configs": [
{
"speaker": "Speaker 1",
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Zephyr"
}
}
},
{
"speaker": "Speaker 2",
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Puck"
}
}
}
]
}
}
}
}' > output.json
echo "Response saved as output.json"const axios = require("axios");
const fs = require("fs");
// API endpoint and headers
const modelId = "gemini-2.5-flash-preview-tts";
const url = `https://api.hyprlab.io/v1beta/models/${modelId}:generateContent?key=${process.env.HYPRLAB_API_KEY}`;
const headers = {
"Content-Type": "application/json",
};
// Request payload
const data = {
contents: [
{
role: "user",
parts: [
{
text: "Read aloud in a warm, welcoming tone\nSpeaker 1: Hello! We are excited to show you our native speech capabilities.\nSpeaker 2: Where you can direct a voice, create realistic dialog, and so much more. Edit these placeholders to get started.",
},
],
},
],
generationConfig: {
responseModalities: ["audio"],
temperature: 1,
speech_config: {
multi_speaker_voice_config: {
speaker_voice_configs: [
{
speaker: "Speaker 1",
voice_config: {
prebuilt_voice_config: {
voice_name: "Zephyr",
},
},
},
{
speaker: "Speaker 2",
voice_config: {
prebuilt_voice_config: {
voice_name: "Puck",
},
},
},
],
},
},
},
};
// Make the request
axios
.post(url, data, { headers })
.then((response) => {
// Save the full JSON response to output.json
fs.writeFileSync("output.json", JSON.stringify(response.data, null, 2));
console.log("Response saved as output.json");
})
.catch((error) => {
console.error("Error:", error.response ? error.response.data : error.message);
});import requests
import json
import os
# API endpoint and headers
model_id = "gemini-2.5-flash-preview-tts"
url = f"https://api.hyprlab.io/v1beta/models/{model_id}:generateContent?key={os.getenv('HYPRLAB_API_KEY')}"
headers = {
"Content-Type": "application/json",
}
# Request payload
data = {
"contents": [
{
"role": "user",
"parts": [
{
"text": "Read aloud in a warm, welcoming tone\nSpeaker 1: Hello! We are excited to show you our native speech capabilities.\nSpeaker 2: Where you can direct a voice, create realistic dialog, and so much more. Edit these placeholders to get started."
}
]
}
],
"generationConfig": {
"responseModalities": ["audio"],
"temperature": 1,
"speech_config": {
"multi_speaker_voice_config": {
"speaker_voice_configs": [
{
"speaker": "Speaker 1",
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Zephyr"
}
}
},
{
"speaker": "Speaker 2",
"voice_config": {
"prebuilt_voice_config": {
"voice_name": "Puck"
}
}
}
]
}
}
}
}
# Make the request
response = requests.post(url, json=data, headers=headers)
# Save the full JSON response to output.json
with open("output.json", "w") as f:
json.dump(response.json(), f, indent=2)
print("Response saved as output.json")Pricing:
Model Name:
gemini-2.5-pro-preview-tts
Discount:
60% off
Input:
$0.4 / 1M Tokens
Output:
$8 / 1M Tokens
Context Length:
32,000
Moderation:
Unfiltered
Capabilities:
Single-Speaker AudioMulti-Speaker Audio
Model Name:
gemini-2.5-flash-preview-tts
Discount:
60% off
Input:
$0.2 / 1M Tokens
Output:
$4 / 1M Tokens
Context Length:
32,000
Moderation:
Unfiltered
Capabilities:
Single-Speaker Audio
Multi-Speaker Audio
Last updated
