- Studio
- Voice
- Text to Speech
Custom pronunciation
Custom pronunciation
Custom pronunciation tells a voice exactly how to say a word that it would otherwise guess from the spelling, such as a brand name, a surname, or an acronym read as a word. This page shows how to write a pronunciation, which phonemes the API accepts, and what to expect when a hint is wrong.
For why voices mispronounce rare words, and how this relates to context biasing in transcription, see Custom vocabulary.
Define a pronunciation
In phoneme_hints, map a word of input to the list of phonemes to say it with. Each phoneme is one string of the list.
curl -s https://api.mistral.ai/v1/audio/speech \
-H "Authorization: Bearer $MISTRAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "voxtral-mini-tts-3-0",
"input": "I like tomato soup.",
"voice_id": "gb_jane_neutral",
"phoneme_hints": {"tomato": ["t", "ə", "m", "ɑ", "t", "oʊ"]},
"response_format": "wav"
}' | jq -r '.audio_data' | base64 --decode > tomato.wav
The voice says "tomato" with the six phonemes of the hint, and reads the rest of the sentence as usual. A few rules apply to the keys and the values:
- One key per word to fix. Add as many words as you need to the same object.
- Context biasing biases the model toward the provided terms; it doesn't require an exact match. For example, if you provide ChatGippiti in the context and the user says ChatGPT, the model is biased to transcribe ChatGippiti.
- The hints apply to one request. Send them with every request whose text contains the words.
Hear the difference
Each pair says the same sentence twice: first without a hint, then with the hint for the word that the voice would otherwise guess.
Sentence | Hint | Without the hint | With the hint |
|---|---|---|---|
| Let's end the debate here: it's GIF. | "GIF": ["dʒ", "ɪ", "f"] | 0:00 / 0:00 | 0:00 / 0:00 |
| Œnologue : c'est mon métier. | "Œnologue": ["e", "n", "ɔ", "l", "ɔ", "g"] | 0:00 / 0:00 | 0:00 / 0:00 |
Accepted phonemes
The API validates each phoneme against its supported IPA inventory. Invalid phonemes are rejected when the request is sent.
Group | Phonemes |
|---|---|
| Vowels | a e i o u y æ ɐ ɑ ɔ ə ɚ ɛ ɜ ɪ ʊ ʌ ʏ ø œ |
| Nasal vowels | ɑ̃ ɔ̃ ɛ̃ œ̃ |
| Diphthongs | aɪ aʊ eɪ oʊ ɔɪ ɔʏ |
| Consonants | b d dʒ f g h j k l m n p pf q r s t ts tʃ v w x z ð ŋ ɖ ɟʝ ɣ ɥ ɦ ɬ ɱ ɲ ɳ ɹ ɾ ʀ ʁ ʃ ʈ ʋ ʎ ʒ ʔ ʝ β θ |
A few symbols differ from what you might type out of habit:
- Type g as the regular keyboard letter, not the IPA character ɡ.
- Write a diphthong, an affricate, or a nasal vowel, such as oʊ, tʃ, or ɛ̃, as one entry, not two.
- Stress and length marks, such as ˈ or ː, aren't in the list.
Limits and errors
The API checks every phoneme of every hint, and rejects the whole request if one of them is invalid:
Situation | What you get | Fix |
|---|---|---|
| A phoneme isn't in the list | A 422 error whose message lists the accepted phonemes | Replace the symbol with one from the list |
Going further
Custom vocabulary
Why names, drugs, and product terms come out wrong in transcription and in generated speech, and the hint that fixes each direction: context biasing for spelling, custom pronunciation for sound.
Style instructions
Steer the delivery of the whole speech output with a short free-form instruction.
Voices
Browse the preset voices and manage the voices saved in your workspace through the API.
Troubleshooting
The errors that speech requests return, the usual causes of speech that sounds wrong, flat, cut short, or slow to start, and the setting that fixes each one.