Endpoint
POST /voice/v1/speak
curl -X POST https://api.case.dev/voice/v1/speak \
-H "Authorization: Bearer sk_case_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "The court finds in favor of the plaintiff.",
"voice_id": "EXAVITQu4vr4xnSDxMaL"
}' \
--output ruling.mp3
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));
import casedev
client = casedev.Casedev(api_key='sk_case_YOUR_API_KEY')
audio = client.voice.v1.speak.create(
text='The court finds in favor of the plaintiff.',
voice_id='EXAVITQu4vr4xnSDxMaL'
)
with open('ruling.mp3', 'wb') as f:
f.write(audio)
audioResp, _ := client.Voice.V1.Speak.New(ctx, casedev.VoiceV1SpeakNewParams{
Text: casedev.F("The court finds in favor of the plaintiff."),
})
// audioResp is *http.Response with audio body
The
casedev CLI does not yet expose a text-to-speech command. Use cURL or one of the supported SDKs above.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to convert to speech |
voice_id | string | No | Voice ID (default: Rachel) |
output_format | string | No | Audio format (default: mp3_44100_128) |
language_code | string | No | Language for multilingual voices |
List voices
Get available voices:curl https://api.case.dev/voice/v1/voices \
-H "Authorization: Bearer sk_case_YOUR_API_KEY"
casedev voice:v1 list-voices
const { voices } = await client.voice.v1.listVoices();
for (const voice of voices) {
console.log(`${voice.name} (${voice.voice_id}): ${voice.labels.description}`);
}
result = client.voice.v1.list_voices()
for voice in result.voices:
print(f'{voice.name} ({voice.voice_id}): {voice.labels.description}')
result, _ := client.Voice.V1.ListVoices(ctx, casedev.VoiceV1ListVoicesParams{})
for _, voice := range result.Voices {
fmt.Printf("%s (%s): %s\n", voice.Name, voice.VoiceID, voice.Labels.Description)
}
Popular voices
| Voice | ID | Description |
|---|---|---|
| Rachel | EXAVITQu4vr4xnSDxMaL | Professional, clear (default) |
| Adam | 21m00Tcm4TlvDq8ikWAM | Deep, authoritative |
| Antoni | ErXwobaYiN019PkySvjV | Well-rounded, calm |
| Josh | TxGEqnHWrfWFTfGW9XjX | Deep, narrative |
Streaming
For lower latency, stream audio as it’s generated:Endpoint
POST /voice/v1/speak/stream
curl -X POST https://api.case.dev/voice/v1/speak \
-H "Authorization: Bearer $CASEDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
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);
audio = client.voice.v1.speak.create(
text='This audio starts playing immediately.',
voice_id='EXAVITQu4vr4xnSDxMaL'
)
with open('streamed.mp3', 'wb') as f:
f.write(audio)
audioResp, _ := client.Voice.V1.Speak.New(ctx, casedev.VoiceV1SpeakNewParams{
Text: casedev.F("The court finds in favor of the plaintiff."),
})
// audioResp is *http.Response with audio body
The
casedev CLI does not yet expose a text-to-speech command. Use cURL or one of the supported SDKs above.Output formats
| Format | Description |
|---|---|
mp3_44100_128 | MP3, 44.1kHz, 128kbps (default) |
mp3_44100_192 | MP3, 44.1kHz, 192kbps |
pcm_16000 | PCM, 16kHz |
pcm_44100 | PCM, 44.1kHz |
Examples
Narrate a document summary
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'
});
audio = 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'
)
resp, _ := client.Voice.V1.Speak.New(ctx, casedev.VoiceV1SpeakNewParams{
Text: casedev.F("Summary of Smith v. Hospital: The plaintiff alleges medical malpractice during a surgical procedure on March 15, 2024..."),
VoiceID: casedev.F("EXAVITQu4vr4xnSDxMaL"),
})
// resp is *http.Response with audio stream
The
casedev CLI does not yet expose a text-to-speech command — use cURL or an SDK. You can still browse the voice catalog with casedev voice:v1 list-voices.Multilingual
const audio = await client.voice.v1.speak.create({
text: 'El tribunal falla a favor del demandante.',
language_code: 'es'
});
audio = client.voice.v1.speak.create(
text='El tribunal falla a favor del demandante.',
language_code='es'
)
resp, _ := client.Voice.V1.Speak.New(ctx, casedev.VoiceV1SpeakNewParams{
Text: casedev.F("El tribunal falla a favor del demandante."),
ModelID: casedev.F(casedev.VoiceV1SpeakNewParamsModelIDElevenMultilingualV2),
})
// resp is *http.Response with audio stream
Pricing: 0.30per1,000characters.A5,000characterdocumentcosts1.50.

