Skip to main content
A pronunciation dictionary is a reusable set of rewrite rules. Each rule swaps a word or phrase for replacement text before it reaches the TTS model, so “SLNG” is spoken as “slang” and “NAIC” as “en ay eye see” on every turn. You create the dictionary once, then reference it by name when you open a TTS session. Rewrite matching is deterministic: case-insensitive, whole-word or whole-phrase, longest-match first, and non-recursive. The walkthrough below uses a WebSocket, but the same pronunciation selector applies to HTTP TTS requests. One dictionary is active per request or WebSocket turn.

Prerequisites

Create and use a dictionary in the same region and organization. A dictionary you create in one region is not visible from another.
1

Create your dictionary

Send the rewrite rules to POST /v1/pronunciation/dictionaries. A successful call returns 201 Created.
Each rule pairs a match term with the replace text sent to the model. A dictionary holds up to 256 rules. Pronunciation fails closed: if a request names a dictionary that cannot be resolved, the TTS request is rejected rather than synthesized without it.
2

Open a TTS WebSocket with the dictionary selected

Connect to a TTS endpoint in the same region and pass the dictionary name in the init config. This example uses Deepgram Aura 2:
Send the API key in the handshake header:
Then send the init message with a pronunciation selector:
3

Send text and collect audio

After the server sends ready, send a text message:
Collect binary audio frames until audio_end. The model speaks “SLNG” as “slang” instead of reading the letters on its own.
4

Reuse the selection across turns

The selection stays active for the session. Send later text messages without repeating pronunciation. To switch dictionaries, include a new selector on the first text message of a later turn.
Keep complete matching words or phrases within a single message, and set the dictionary before a turn begins rather than mid-turn. To speak without rewriting, open a new session with no pronunciation selector.

Hear the difference

Both clips synthesize the same line. The dictionary rewrites SLNG, QubePay, and ACH so the model speaks them as intended instead of guessing.

API reference

Pronunciation dictionaries API

Create, list, read, and delete dictionaries, with the full rewrite contract and error codes.