Documentation Index Fetch the complete documentation index at: https://docs.deepdub.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
All you need is:
Free trial API key: dd-00000000000000000000000065c9cbfe
A voice preset — see Voice Presets for the full list
Generate speech with the Python SDK
Generate audio
from deepdub import DeepdubClient
client = DeepdubClient( api_key = "dd-00000000000000000000000065c9cbfe" )
audio = client.tts(
text = "Welcome to Deepdub! This is your first generated audio." ,
voice_prompt_id = "50a537cf-1ec8-4714-b07e-c589ab76be4b" , # Promo / Commercials
model = "dd-etts-3.0" ,
locale = "en-US" ,
)
with open ( "output.mp3" , "wb" ) as f:
f.write(audio)
print ( f "Generated { len (audio) } bytes of audio" )
Generate speech with the JavaScript SDK
Install the SDK
npm install --save @deepdub/node
Generate audio
const { DeepdubClient } = require ( "@deepdub/node" );
async function main () {
const deepdub = new DeepdubClient ( "dd-00000000000000000000000065c9cbfe" );
await deepdub . connect ();
const buffer = await deepdub . generateToBuffer (
"Welcome to Deepdub! This is your first generated audio." ,
{
locale: "en-US" ,
voicePromptId: "50a537cf-1ec8-4714-b07e-c589ab76be4b" , // Promo / Commercials
model: "dd-etts-3.0" ,
}
);
require ( "fs" ). writeFileSync ( "output.wav" , buffer );
console . log ( `Generated ${ buffer . length } bytes of audio` );
}
main ();
Generate speech with cURL
curl -X POST https://restapi.deepdub.ai/api/v1/tts \
-H "Content-Type: application/json" \
-H "x-api-key: dd-00000000000000000000000065c9cbfe" \
-d '{
"model": "dd-etts-3.0",
"targetText": "Welcome to Deepdub! This is your first generated audio.",
"locale": "en-US",
"voicePromptId": "50a537cf-1ec8-4714-b07e-c589ab76be4b"
}' \
--output output.mp3
Advanced generation options
Fine-tune your audio with accent blending and tuned parameters:
audio = client.tts(
text = "This demonstrates accent blending with tuned parameters." ,
voice_prompt_id = "bd1b00bb-be1c-4679-8eaa-0fcbfd4ff773" , # Storyteller
model = "dd-etts-3.0" ,
locale = "en-US" ,
temperature = 0.7 ,
tempo = 1.1 ,
variance = 0.6 ,
sample_rate = 44100 ,
format = "mp3" ,
prompt_boost = True ,
accent_base_locale = "en-US" ,
accent_locale = "fr-FR" ,
accent_ratio = 0.3 ,
)
with open ( "advanced_output.mp3" , "wb" ) as f:
f.write(audio)
Real-time streaming
For low-latency applications, stream audio chunks as they’re generated:
Python SDK
JavaScript SDK
import asyncio
from deepdub import DeepdubClient
client = DeepdubClient( api_key = "dd-00000000000000000000000065c9cbfe" )
async def stream ():
audio_data = bytearray ()
async with client.async_connect() as conn:
async for chunk in conn.async_tts(
text = "Streaming audio in real time!" ,
voice_prompt_id = "bd1b00bb-be1c-4679-8eaa-0fcbfd4ff773" ,
model = "dd-etts-3.0" ,
locale = "en-US" ,
format = "wav" ,
sample_rate = 16000 ,
):
audio_data.extend(chunk)
print ( f "Received chunk: { len (chunk) } bytes" )
with open ( "streamed.wav" , "wb" ) as f:
f.write(audio_data)
print ( f "Total audio: { len (audio_data) } bytes" )
asyncio.run(stream())
const { DeepdubClient } = require ( "@deepdub/node" );
async function main () {
const deepdub = new DeepdubClient ( "dd-00000000000000000000000065c9cbfe" );
await deepdub . connect ();
const buffer = await deepdub . generateToBuffer ( "Streaming audio in real time!" , {
locale: "en-US" ,
voicePromptId: "50a537cf-1ec8-4714-b07e-c589ab76be4b" ,
model: "dd-etts-3.0" ,
onChunk : ( chunk ) => {
console . log ( `Received ${ chunk . length } bytes` );
},
});
require ( "fs" ). writeFileSync ( "streamed.wav" , buffer );
}
main ();
Next steps
Voice Presets Browse curated voice presets from our library of thousands of voices.
Python SDK Reference Full Python SDK reference with all methods and async streaming.
JavaScript SDK Reference Full Node.js SDK reference with streaming chunks and concurrent generation.
REST API Reference Explore all TTS parameters and response formats.