VOICE / bias-stt-with-language-hint-and-keyterms

Voice

Bias Speech to Speech transcription with language_hint and keyterms

Bias Speech to Speech transcription with language_hint and keyterms

Set audio.input.transcription.language_hint and keyterms on session.update. Both can change mid-session. The model still auto-detects language when you omit the hint.

Language hint

Pass a BCP-47 code. Spanish and Portuguese need a regional variant — "es" and "pt" are rejected. Unknown codes are ignored and detection stays automatic.

import json

await ws.send(json.dumps({
    "type": "session.update",
    "session": {
        "audio": {
            "input": {
                "transcription": {
                    "language_hint": "ja"
                }
            }
        }
    }
}))
Language Code
English en
Japanese ja
Spanish (Mexico) es-MX
Spanish (Spain) es-ES
Portuguese (Brazil) pt-BR
Portuguese (Portugal) pt-PT
Arabic (Egypt) ar-EG
Arabic (Saudi Arabia) ar-SA
Arabic (UAE) ar-AE
Chinese (Simplified) zh
French fr
German de
Hindi hi
Indonesian id
Italian it
Korean ko
Bengali bn
Russian ru
Turkish tr
Vietnamese vi

The roster above is the documented native-quality set. You can still put a preferred language or accent in instructions for the spoken reply.

Keyterms

Bias ASR toward product names, proper nouns, and domain terms. Max 100 strings, each up to 50 characters.

await ws.send(json.dumps({
    "type": "session.update",
    "session": {
        "audio": {
            "input": {
                "transcription": {
                    "language_hint": "en",
                    "keyterms": ["xAI", "Grok", "Understand The Universe"]
                }
            }
        }
    }
}))

Send another session.update when the caller switches language or when a new term list should apply.

Pitfalls

  • Bare "es" / "pt" fail; use es-MX, es-ES, pt-BR, or pt-PT.
  • A typo in language_hint is silent — transcription falls back to auto-detect.
  • Keyterms over 50 characters or more than 100 entries are invalid; keep the list short and specific.
  • Console API credits are separate from SuperGrok's weekly pool on grok.com.