Custom dictionaries are per-project pronunciation and replacement lists.
Each entry maps a written word to the text or IPA the TTS pipeline should
pronounce instead. Use them for brand names, product names, acronyms, and
domain vocabulary that should sound consistent across requests.
Changes apply to the next synthesis request after the dictionary mutation
finishes. By default all active dictionaries of the API key’s project are
applied automatically (filtered by request language); pass dictionary_ids
on a request to select dictionaries per request
([] = none; a list = exactly those, including inactive ones).
For the full HTTP contract, field limits, master-key project_id rules,
and error codes, see the Dictionaries API reference.
Create a Dictionary
from kugelaudio import KugelAudio
client = KugelAudio(api_key="YOUR_API_KEY")
dictionary = client.dictionaries.create(
name="Brand names",
description="Product and company names",
language="en",
)
print(dictionary.id)
Manage Dictionaries
# List every dictionary in the project
dictionaries = client.dictionaries.list()
# Fetch one
dictionary = client.dictionaries.get(dictionary.id)
# Update name / description / language / is_active (only provided fields change)
dictionary = client.dictionaries.update(
dictionary.id,
description="Updated description",
is_active=False,
)
# Delete a dictionary (cascades to its entries)
client.dictionaries.delete(dictionary.id)
Every dictionary and entry method accepts a keyword-only project_id. It is
required only for master-key callers acting on a specific project; with a
normal project-scoped API key, omit it.
Add and Manage Entries
Use replacement for normal spelling-based fixes. Use ipa when you need
an exact phonetic pronunciation; IPA takes precedence over replacement.
created_entry = client.dictionaries.entries.add(
dictionary.id,
word="Postgres",
replacement="post-gres",
)
page = client.dictionaries.entries.list(
dictionary.id,
search="post",
limit=50,
)
for entry in page.entries:
print(f"{entry.word} → {entry.replacement}")
client.dictionaries.entries.update(
dictionary.id,
page.entries[0].id,
replacement="postgres",
)
client.dictionaries.entries.delete(dictionary.id, page.entries[0].id)
Atomic Bulk Sync
replace_all upserts every entry in one transaction and deletes entries
currently in the dictionary whose word is not in the payload. Use it to
sync from a CMS, PIM, or internal glossary.
replace_all is intentionally destructive for omitted words. Only call it
with the complete desired contents of that dictionary.
result = client.dictionaries.entries.replace_all(
dictionary.id,
entries=[
{"word": "Postgres", "replacement": "post-gres"},
{"word": "Kubernetes", "replacement": "koo-ber-net-eez"},
],
)
print(f"upserted={result.upserted} deleted={result.deleted}")
Generate With Dictionaries
Keep normalize enabled unless you have a specific reason to bypass text
normalization.
audio = client.tts.generate(
text="Postgres runs our product analytics.",
model_id="kugel-3",
language="en",
normalize=True,
)
Next steps