Bias context and vocabulary

Context biasing steers transcription toward the names, terms, and acronyms you expect, so they come out spelled the way you write them. You send it as a list of entries, each one a keyphrase or a description of the recording, in file and realtime transcription alike.

i
Information

For why names come out wrong and when each kind of context fits, see Custom vocabulary.

API reference — POST /v1/audio/transcriptions
Bias with keyphrases

Bias with keyphrases

To fix specific terms, send each one as an entry of context_bias. An entry can hold several words, such as a company name.

import os

from mistralai.client import Mistral

client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])

def transcribe(context_bias=None):
    with open("customer_call.wav", "rb") as audio:
        return client.audio.transcriptions.complete(
            model="voxtral-mini-transcribe-3",
            file={"file_name": "customer_call.wav", "content": audio},
            context_bias=context_bias,
        ).text

print("Without bias:", transcribe())
print("With bias:   ", transcribe(["Northwind", "Quillara", "Alder Creek Design", "Rotterdam"]))

The example transcribes the same call twice, without and with context. The product name and the company name change:

Without bias: Thanks for calling Northwind Support. [...] I ordered two Quilliera headsets last week. [...] I also need an invoice for my company, Older Creek Design. [...]
With bias:    Thanks for calling Northwind Support. [...] I ordered two Quillara headsets last week, [...] I also need an invoice for my company, Alder Creek Design. [...]
Describe the recording

Describe the recording

An entry can also be a sentence or a paragraph that describes the recording: what it's about, who speaks, and which names come up. Send it the same way as a keyphrase.

curl https://api.mistral.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -F model=voxtral-mini-transcribe-3 \
  -F file=@customer_call.wav \
  -F "context_bias=Support call for Northwind about an order of Quillara headsets shipped from the Rotterdam warehouse and invoiced to Alder Creek Design."
Tip

List every term that must come out right as its own keyphrase. When the recording has a clear subject, add a description to the same list. In realtime sessions, a description alone might not fix a term that a keyphrase fixes.

Use it in realtime sessions

Use it in realtime sessions

In a realtime session, send context_bias as a JSON array of strings in session.update, before the first audio chunk.

{
  "type": "session.update",
  "session": {
    "audio_format": { "encoding": "pcm_s16le", "sample_rate": 24000 },
    "context_bias": ["Northwind", "Quillara", "Alder Creek Design", "Rotterdam"]
  }
}

The context applies to the whole session. After the first audio chunk, the session rejects any change to its fields with an error event.

i
Information
Entry format

Entry format

Both modes take the same entries, sent in a different way:

File transcriptionRealtime session
How to send itRepeat the context_bias form field once per entry. In Python, pass a list of strings.Set context_bias to an array of strings in session.update.
One entryA term, a name of several words, or a description of the recordingSame
CharactersSpaces, commas, and other punctuation are acceptedSame
DefaultNo contextNo context (an empty array)
ScopeThe requestThe whole session, set before the first audio chunk
Modelsvoxtral-mini-transcribe-3, voxtral-small-transcribe-3voxtral-mini-transcribe-realtime-3
Limits and errors

Limits and errors

Context has no budget of its own: its entries count toward the model's context window, together with the audio. A long recording leaves less room for context, so keep the list to the terms and descriptions that matter.

When the audio and the context together go over the window, the request fails and the API doesn't shorten your list:

SituationModeWhat you get
The audio and the context exceed the context windowFile transcriptionA 400 error of type invalid_request_prompt_too_long, whose message gives the size of the request and the maximum
session.update sent after the first audio chunkRealtime sessionAn error event: Session fields cannot be changed after audio has started.
Going further

Going further