Skip to navigation

Getting started with Flux TTS batch (REST)

Synthesize a complete block of text with the Flux TTS batch endpoint (POST /v2/speak) and stream the audio back in chunks, for pre-rendering fixed audio.

The batch (REST) transport synthesizes a complete block of text and returns the audio in one HTTP response. The response body streams back in chunks as the audio is generated, so playback can start on the first bytes. Use it to pre-generate fixed audio (IVR prompts, notifications, audiobook lines) where the whole text is known up front and you don’t need to stream text in or interrupt playback. For live, interruptible conversations, use the real-time WebSocket instead (see Batch vs Streaming).

Batch is stateless request/response: simple retries, high fan-out, no connection lifecycle to manage. It serves the same Deepgram Flux TTS voices as the streaming transport.

Make a request

curl "https://api.deepgram.com/v2/speak?model=flux-haley-en" \
-H "Authorization: Token YOUR_DEEPGRAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "Your appointment is confirmed for 3pm tomorrow." }' \
--output audio.mp3

The response body is the synthesized audio in the requested encoding, streamed back as it’s generated when you don’t set callback. It has no Content-Length, and HTTP/1.1 clients see Transfer-Encoding: chunked. HTTP/2 clients see neither header. Read it as a stream to play or forward audio while the rest is still arriving. The JavaScript, Python, Java, and Rust SDKs expose the body as a stream; the Go and .NET SDKs return the complete audio once the response finishes. Per-request telemetry is returned as response headers, mirroring Deepgram Aura’s REST conventions: character counts and the generic dg-warnings header.

Query parameters

ParameterDefaultDescription
model—Required. A flux-{voice}-{language} model (e.g. flux-haley-en).
encodingmp3mp3, opus, flac, aac (containerized/compressed), or raw linear16 / mulaw / alaw.
bit_rateper-encoding defaultBit rate for compressed encodings. For mp3: 8000, 16000, 24000, 32000, 40000, 48000.
containerper-encoding defaultOutput container where applicable (e.g. wav for linear16, ogg for opus).
sample_ratemodel nativeSample rate; supported values depend on encoding. linear16: 8000, 16000, 24000, 32000, 44100, 48000. mulaw / alaw: 8000, 16000. flac: 8000, 16000, 22050, 32000, 48000. Not applicable to mp3 or opus.
speed1.0Speech-rate multiplier — 0.5 to 1.5 in 0.05 increments. Not supported by every model or language; unsupported combinations return SPEED_NOT_SUPPORTED.
expressivity0Beta. Delivery register, -2 (calm) to 2 (animated). See Expressivity.
callback—URL to receive the result asynchronously, instead of on the response body.
callback_methodPOSTHTTP method for the callback request (POST or PUT).
priority—Prioritization for asynchronous (callback) requests. Only value: Low.
tag—Label requests for usage reporting. Repeatable.
mip_opt_outfalseOpt out of the Model Improvement Program.
normalize_volumetrueNormalizes loudness to a consistent level across voices and requests. Set to false to opt out; peak limiting still applies. See Volume normalization.

Conversational constructs (Flush, Interrupt, speech_id, lifecycle events) do not apply to batch. model, speed, expressivity, and the media-output settings behave the same as on the streaming surface, so the contract doesn’t fragment across transports. The one difference is inline pause: it’s supported on batch only. See Speed, pause, pronunciation.

When to use batch vs streaming

See Batch vs streaming: which should I use? for the decision guide.