List Available Voices
- Python
- JavaScript
- Java
- cURL
# List all available voices
result = client.voices.list()
for voice in result.voices:
print(f"{voice.id}: {voice.name}")
print(f" Category: {voice.category}")
print(f" Languages: {', '.join(voice.supported_languages)}")
// List all available voices
const result = await client.voices.list();
for (const voice of result.voices) {
console.log(`${voice.id}: ${voice.name}`);
console.log(` Category: ${voice.category}`);
console.log(` Languages: ${voice.supportedLanguages.join(', ')}`);
}
import com.kugelaudio.sdk.Voice;
import com.kugelaudio.sdk.VoiceListResponse;
VoiceListResponse result = client.voices().list();
for (Voice voice : result.getVoices()) {
System.out.printf("%d: %s%n", voice.getId(), voice.getName());
System.out.printf(" Quality: %s%n", voice.getQuality());
}
curl https://api.kugelaudio.com/v1/voices \
-H "Authorization: Bearer $KUGELAUDIO_API_KEY"
Paginate Voices
- Python
- JavaScript
- Java
- cURL
# Limit results
result = client.voices.list(limit=10)
# Paginate through all voices
result = client.voices.list(limit=10, offset=20)
print(f"Showing {len(result.voices)} of {result.total} voices")
// Limit results
const { voices: first10 } = await client.voices.list({ limit: 10 });
// Paginate
const { voices, total } = await client.voices.list({ limit: 10, offset: 20 });
// Paginate
VoiceListResponse page = client.voices().list(null, null, 10, 20);
System.out.printf("Showing %d of %d%n", page.getVoices().size(), page.getTotal());
# Limit results
curl "https://api.kugelaudio.com/v1/voices?limit=10" \
-H "Authorization: Bearer $KUGELAUDIO_API_KEY"
Get Voice Details
- Python
- JavaScript
- Java
- cURL
voice = client.voices.get(voice_id=1071)
print(f"Voice: {voice.name}")
print(f"Description: {voice.description}")
print(f"Sample URL: {voice.sample_url}")
const voice = await client.voices.get(1071);
console.log(`Voice: ${voice.name}`);
console.log(`Description: ${voice.description}`);
console.log(`Sample URL: ${voice.sampleUrl}`);
VoiceDetail voice = client.voices().get(1071);
System.out.printf("Voice: %s%n", voice.getName());
System.out.printf("Sample URL: %s%n", voice.getSampleUrl());
curl https://api.kugelaudio.com/v1/voices/1071 \
-H "Authorization: Bearer $KUGELAUDIO_API_KEY"
Use a Specific Voice
Pass thevoice_id (Python), voiceId (JavaScript), or voice_id JSON field (cURL) when generating speech:
- Python
- JavaScript
- Java
- cURL
audio = client.tts.generate(
text="Hello with a specific voice!",
model_id="kugel-3",
voice_id=1071,
)
const audio = await client.tts.generate({
text: 'Hello with a specific voice!',
modelId: 'kugel-3',
voiceId: 1071,
});
AudioResponse audio = client.tts().generate(
GenerateRequest.builder("Hello with a specific voice!")
.modelId("kugel-3")
.voiceId(1071)
.language("en")
.build()
);
curl -X POST https://api.kugelaudio.com/v1/tts/generate \
-H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello with a specific voice!",
"model_id": "kugel-3",
"voice_id": 1071
}' \
--output output.pcm
- Python
- JavaScript
- Java
- cURL
# With streaming
for chunk in client.tts.stream(
text="Streaming with a specific voice.",
model_id="kugel-3",
voice_id=1071,
):
if hasattr(chunk, 'audio'):
play_audio(chunk.audio)
# With streaming sessions (for LLM integration)
async with client.tts.streaming_session(
voice_id=1071,
cfg_scale=2.0,
) as session:
async for chunk in session.send("Hello!"):
play_audio(chunk.audio)
// With streaming
await client.tts.stream(
{ text: 'Streaming with a specific voice.', modelId: 'kugel-3', voiceId: 1071 },
{ onChunk: (chunk) => playAudio(chunk.audio) }
);
// With streaming
client.tts().stream(
GenerateRequest.builder("Streaming with a specific voice.")
.modelId("kugel-3")
.voiceId(1071)
.language("en")
.build(),
new StreamCallbacks() {
@Override
public void onChunk(AudioChunk chunk) {
playAudio(chunk.getAudio());
}
}
);
# Stream with a specific voice and pipe to ffplay
curl -X POST https://api.kugelaudio.com/v1/tts/generate \
-H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Streaming with a specific voice.",
"model_id": "kugel-3",
"voice_id": 1071
}' \
--no-buffer | ffplay -f s16le -ar 24000 -ac 1 -nodisp -
Voice Properties
Each voice includes the following information:| Property | Type | Description |
|---|---|---|
id | int | Unique voice ID |
voice_id | int | Same value as id for backward compatibility |
handle | string | null | Public voice handle, when assigned |
public_id | string | null | Public identifier, when assigned |
name | string | Human-readable name |
description | string | null | Voice description |
category | string | Voice catalog category |
sex | string | null | male, female, or neutral |
age | string | null | Voice age label |
quality | string | Voice quality label |
supported_languages | list | ISO 639-1 language codes |
sample_url | string | null | Sample audio URL |
avatar_url | string | null | Voice avatar URL |
Next Steps
Voice Cloning
Create custom voices from audio samples
Generate Speech
Generate audio with your chosen voice
Streaming
Stream audio in real-time