Skip to main content

List Available Voices

// List all available voices (returns VoiceListResponse)
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(', ')}`);
}
console.log(`Showing ${result.voices.length} of ${result.total}`);

// Filter by language
const germanResult = await client.voices.list({ language: 'de' });

// Paginate
const page2 = await client.voices.list({ limit: 10, offset: 10 });
console.log(`Page 2: ${page2.voices.length} voices (total: ${page2.total})`);

Get a Specific Voice

const voice = await client.voices.get(1071);
console.log(`Voice: ${voice.name}`);
console.log(`Category: ${voice.category}`);

Create a Voice

Create a new voice with optional reference audio files:
// Browser — use File objects from an <input type="file">
const fileInput = document.getElementById('audio-upload') as HTMLInputElement;
const files = Array.from(fileInput.files!);

const voice = await client.voices.create({
  name: 'My Custom Voice',
  sex: 'female',
  description: 'A warm, conversational voice',
  category: 'cloned',
  referenceFiles: files,
});
console.log(`Created voice: ${voice.id}`);
// Node.js — use Blob constructed from a Buffer
import { readFileSync } from 'fs';

const buf = readFileSync('reference.wav');
const blob = new Blob([buf], { type: 'audio/wav' });

const voice = await client.voices.create({
  name: 'My Custom Voice',
  sex: 'female',
  referenceFiles: [blob],
});

Update a Voice

const voice = await client.voices.update(1071, {
  name: 'Updated Name',
  description: 'New description',
});

Delete a Voice

await client.voices.delete(1071);

Manage Reference Audio

// List references for a voice
const refs = await client.voices.listReferences(1071);
for (const ref of refs) {
  console.log(`${ref.id}: ${ref.name}`);
}

// Add a new reference
const ref = await client.voices.addReference(1071, audioFile, 'Optional transcript.');

// Delete a reference
await client.voices.deleteReference(1071, 456);

Publish a Voice

Request that your voice be made publicly available. An admin will verify it before it becomes visible to others.
const voice = await client.voices.publish(1071);
console.log(`Pending verification: ${voice.pendingVerification}`);

Generate Voice Sample

Trigger sample audio generation for a voice:
const voice = await client.voices.generateSample(1071);
console.log(`Sample URL: ${voice.sampleUrl}`);

The Voice, VoiceDetail, VoiceReference, and create/update option interfaces are documented in Types & Errors.