For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Ask AIPlaygroundLoginFree API Key
HomeAPI ReferenceVoice AgentSpeech-to-TextText-to-SpeechIntelligenceSelf-Hosted Deployments
HomeAPI ReferenceVoice AgentSpeech-to-TextText-to-SpeechIntelligenceSelf-Hosted Deployments
  • General
    • Deepgram API Overview
    • Authentication
    • Regional Endpoints
    • Custom Endpoints
    • Errors
    • API Rate Limits
  • API Reference
        • WSSContinuous Text Stream
        • POSTSingle Text Request
LogoLogo
Ask AIPlaygroundLoginFree API Key
API ReferenceText to Speech

Continuous Text Stream

WSS
wss://api.deepgram.com/v1/speak
Handshake
URLwss://api.deepgram.com/v1/speak
MethodGET
Status101 Switching Protocols
Try it
Messages

Convert text into natural-sounding speech using Deepgram’s TTS WebSocket

Was this page helpful?
Previous

Single Text Request

Next
Built with

HandshakeTry it

WSS
wss://api.deepgram.com/v1/speak

Authentication

AuthorizationToken

Use Authorization: Token <API_KEY> Example: Authorization: Token 12345abcdef

OR
AuthorizationBearer

Use Authorization: Bearer <JWT> Example: Authorization: Bearer eyJhbGciOiJ...

Headers

AuthorizationstringRequired
Use your API key or a [temporary token](/guides/fundamentals/token-based-authentication) for authentication via the `Authorization` header. In client-side environments where custom headers are not supported, use the [`Sec-WebSocket-Protocol`](/guides/deep-dives/using-the-sec-websocket-protocol) header instead. **Example:** `Authorization: Token %DEEPGRAM_API_KEY%` or `Authorization: Bearer %DEEPGRAM_TOKEN%`

Query parameters

encodingenumOptionalDefaults to linear16

Encoding allows you to specify the expected encoding of your audio output for streaming TTS. Only streaming-compatible encodings are supported.

Allowed values:
mip_opt_outanyOptionalDefaults to false
Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip
modelenumOptionalDefaults to aura-asteria-en
AI model used to process submitted text
sample_rateenumOptionalDefaults to 24000
Sample Rate specifies the sample rate for the output audio. Based on encoding 8000 or 24000 are possible defaults. For some encodings sample rate is not configurable.
Allowed values:
speeddoubleOptional0.7-1.5Defaults to 1
Speaking rate multiplier that adjusts the pace of generated speech while preserving natural prosody and voice quality. Not yet supported in all languages.

Send

SpeakV1TextobjectRequired
Text to convert to audio
OR
SpeakV1FlushobjectRequired
Flush the buffer and receive the final audio for text sent so far
OR
SpeakV1ClearobjectRequired
Clear the buffer and start a new audio generation. Potentially destructive operation for any text in the buffer
OR
SpeakV1CloseobjectRequired
Flush the buffer and close the connection gracefully after all audio is generated

Receive

SpeakV1AudiostringRequiredformat: "binary"
Receive audio chunks as they are generated
OR
SpeakV1MetadataobjectRequired
Receive metadata about the audio generation
OR
SpeakV1FlushedobjectRequired
Receive metadata about the audio generation
OR
SpeakV1ClearedobjectRequired
Receive metadata about the audio generation
OR
SpeakV1WarningobjectRequired
Receive a warning about the audio generation

Use your API key or a temporary token for authentication via the Authorization header. In client-side environments where custom headers are not supported, use the Sec-WebSocket-Protocol header instead.

Example: Authorization: Token %DEEPGRAM_API_KEY% or Authorization: Bearer %DEEPGRAM_TOKEN%

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip