Skip to main content
Multiple voices, streaming support, multilingual.
Endpoint
POST /voice/v1/speak
import Casedev from 'casedev';

const client = new Casedev({ apiKey: 'sk_case_YOUR_API_KEY' });

const audio = await client.voice.v1.speak.create({
  text: 'The court finds in favor of the plaintiff.',
  voice_id: 'EXAVITQu4vr4xnSDxMaL'
});

// Save to file
fs.writeFileSync('ruling.mp3', Buffer.from(audio));

Parameters

ParameterTypeRequiredDescription
textstringYesText to convert to speech
voice_idstringNoVoice ID (default: Rachel)
output_formatstringNoAudio format (default: mp3_44100_128)
language_codestringNoLanguage for multilingual voices

List voices

Get available voices:
const { voices } = await client.voice.v1.listVoices();

for (const voice of voices) {
  console.log(`${voice.name} (${voice.voice_id}): ${voice.labels.description}`);
}
VoiceIDDescription
RachelEXAVITQu4vr4xnSDxMaLProfessional, clear (default)
Adam21m00Tcm4TlvDq8ikWAMDeep, authoritative
AntoniErXwobaYiN019PkySvjVWell-rounded, calm
JoshTxGEqnHWrfWFTfGW9XjXDeep, narrative

Streaming

For lower latency, stream audio as it’s generated:
Endpoint
POST /voice/v1/speak/stream
const stream = await client.voice.v1.speak.stream({
  text: 'This audio starts playing immediately.',
  voice_id: 'EXAVITQu4vr4xnSDxMaL'
});

// Pipe to file or audio player
const writeStream = fs.createWriteStream('streamed.mp3');
stream.pipe(writeStream);

Output formats

FormatDescription
mp3_44100_128MP3, 44.1kHz, 128kbps (default)
mp3_44100_192MP3, 44.1kHz, 192kbps
pcm_16000PCM, 16kHz
pcm_44100PCM, 44.1kHz

Examples

Narrate a document summary

TypeScript
const audio = await client.voice.v1.speak.create({
  text: `Summary of Smith v. Hospital: The plaintiff alleges medical
         malpractice during a surgical procedure on March 15, 2024...`,
  voice_id: 'EXAVITQu4vr4xnSDxMaL'
});

Multilingual

TypeScript
const audio = await client.voice.v1.speak.create({
  text: 'El tribunal falla a favor del demandante.',
  language_code: 'es'
});
Pricing: 0.30per1,000characters.A5,000characterdocumentcosts0.30 per 1,000 characters. A 5,000 character document costs 1.50.