Overview
You send one complete text, and the audio streams out to you as it is generated — delivered incrementally as base64-encoded chunks, so playback can begin before the full generation finishes.This endpoint takes the same generation parameters as the REST TTS endpoint, but delivers audio as a stream of chunks rather than a single response.
If your text is not complete up front — for example it arrives token-by-token from an LLM — you want text to stream in as well. Use the Streaming In and Streaming Out API (
/ws) for that. This page documents the single-request text-to-speech protocol (/open).Connection
Connect to the/open endpoint with your API key:
Authentication is handled during the WebSocket handshake via the
x-api-key header or query parameter.
Request format
Send a JSON message on the WebSocket connection:string
default:"text-to-speech"
The type of generation request.
string
required
Model ID to use for generation (e.g.,
dd-etts-3.0).string
required
Text to convert to speech.
string
required
Language locale code (e.g.,
en-US, fr-FR).string
required
ID of the voice prompt to use. Supports
asset: prefix for built-in voices.string
Optional client-provided ID. Auto-generated if not provided.
number
Target audio duration in seconds.
number
Playback speed multiplier, between 0 and 2. Mutually exclusive with
targetDuration — sending both is rejected.number
Voice variation level (0.0-1.0).
integer
Random seed for deterministic generation. Applies to
dd-etts-1.1 only — newer models do not use it, and setting it has no effect on their output.number
Generation temperature (0.0-1.0).
integer
Output sample rate in Hz. One of
8000, 16000, 22050, 24000, 32000, 36000, 44100, or 48000; any other value is rejected. Internal generation is 48 kHz, resampled to the requested rate. Defaults to 8000 Hz for mulaw if not specified.string
default:"wav"
Output audio format:
wav (default), mp3, opus, mulaw, or s16le.boolean
Enhance voice prompt characteristics.
boolean
Enable super stretch mode for longer audio.
boolean
Enable real-time priority processing.
boolean
default:"true"
Apply audio cleanup processing.
boolean
Automatically adjust audio gain levels.
object
Accent blending parameters. See AccentControl below.
string
ID of a performance reference prompt to guide delivery style.
string
Target speaker gender,
male or female. Used for language-specific handling such as Hebrew diacritics. Other values are ignored rather than rejected.boolean
default:"false"
Return the diacritized (menukad) form of the Hebrew
targetText alongside the audio. When enabled, the first audio chunk carries a diacritized field.boolean
default:"true"
Whether Deepdub may record this request’s text in its server-side logs. Set to
false for confidential scripts to keep the text out of the logs.outputDiacritized is available on request rather than enabled for every account. Contact support@deepdub.ai to have it turned on before integrating against it.Example request
Response format
Audio chunks
Audio is delivered as a series of JSON messages. Each chunk contains a portion of the audio data:integer
Sequential chunk index starting from 0.
string
The generation ID for this request. Use this to correlate chunks with requests when running multiple generations on the same connection.
string
Base64-encoded audio data for this chunk.
boolean
true when this is the final chunk of the generation.string
Diacritized (menukad) Hebrew text for the request. Sent only when
outputDiacritized was enabled, and only on the first audio chunk — later chunks omit the field entirely.Example response stream
Initial acknowledgement:outputDiacritized is enabled:
Error responses
When an error occurs, the WebSocket sends a JSON error message:string
Human-readable error description.
string
Error category. One of:
RateLimit, MaxExceeded, InsufficientCredits, InvalidInput. Present on requests rejected up front; errors raised later, once generation is already under way, carry only error and generationId.string
The generation ID, if available.
The free trial key is additionally capped at 10 generations per IP per day. Once that is used up, requests fail with
errorType: "RateLimit" and a message of the form Free tier quota exceeded (used: 10). Please get an API key to continue. Get your own API key to lift the cap.Accent control
Blend accents between two locales using theaccentControl object:
Supported output formats
Audio chunks are delivered as base64-encoded data in JSON messages.Sample rates
Valid values are8000, 16000, 22050, 24000, 32000, 36000, 44100, and 48000 Hz. The internal generation runs at 48 kHz and is resampled to the requested rate. If no sample rate is specified, mulaw defaults to 8000 Hz.
