Skip to main content

Nabrah STT plugin guide

How to use the Nabrah STT plugin for LiveKit Agents.

Available inPython

Overview

This plugin allows you to use Nabrah  as an STT provider for your voice agents. Nabrah is a streaming speech-to-text service for Arabic, and the plugin includes end-of-turn detection tuned for Arabic conversation.

Installation

Install the plugin:

uv add "livekit-agents[nabrah]~=1.8"

Authentication

The Nabrah plugin requires a Nabrah API key.

Set NABRAH_API_KEY in your .env file:

NABRAH_API_KEY=<your-nabrah-api-key>

Usage

Use Nabrah STT in an AgentSession or as a standalone transcription service. For example, you can use this STT in the Voice AI quickstart.

The default eot_nabrah model emits an end-of-turn signal, so let the STT drive turn detection:

from livekit.agents import AgentSession
from livekit.plugins import nabrah
session = AgentSession(
stt=nabrah.STT(
recognition_model="eot_nabrah",
language="ar-SA",
),
turn_handling={"turn_detection": "stt", "endpointing": {"min_delay": 0}},
# ... llm, tts, etc.
)

Turn detection

With recognition_model="eot_nabrah", the recognizer signals when the speaker has likely finished a turn. The plugin waits end_of_turn_confirm_delay_seconds (0.4 seconds by default) after that signal before committing the turn. If the user speaks again inside that window, the turn stays open. Set it to None to commit as soon as the signal arrives.

Nabrah's default model (recognition_model="") is more accurate but doesn't emit an end-of-turn signal. When you use it, configure another turn detector, or set max_transcript_inactivity_seconds as a fallback that commits the turn after that many seconds without new transcript text. The fallback is off by default because it measures recognizer inactivity, not acoustic silence, so a provider delay can split continuous speech.

To learn more, see Turn detection.

Word boosting

Bias recognition toward names and terms the model gets wrong with priority_words. Multi-word phrases are boosted as a unit:

stt = nabrah.STT(
priority_words=["مستشفى الملك فيصل التخصصي", "رقم الهوية الوطنية"],
priority_words_strength=0.5,
)

0.5 is the recommended strength. Higher values make boosted terms appear where they weren't said, so keep the list to terms your users actually say.

For longer lists, keep the terms in a JSON file so you can edit them without touching code. Read the file with encoding="utf-8" so Arabic terms load correctly on every platform:

import json
import pathlib
boosting = json.loads(
pathlib.Path(__file__).with_name("boosting.json").read_text(encoding="utf-8")
)
stt = nabrah.STT(
priority_words=boosting["words"],
priority_words_strength=boosting["boost_threshold"],
)

Parameters

This section describes some of the available parameters. See the plugin reference for a complete list.

recognition_modelstringDefault: eot_nabrah

"eot_nabrah" emits the end-of-turn signal used for turn detection. "" selects Nabrah's default model, which is more accurate but emits no signal. See Turn detection.

languagestringDefault: ar-SA

Recognition language.

end_of_turn_confirm_delay_secondsfloatDefault: 0.4

Seconds to wait after an end-of-turn signal before committing the turn. None commits immediately.

max_transcript_inactivity_secondsfloatDefault: None

Commits the turn after this many seconds without new transcript text. Disabled by default.

priority_wordslist[string]Default: []

Words and phrases to bias recognition toward. See Word boosting.

priority_words_strengthfloatDefault: 0.5

How strongly to bias recognition toward priority_words.

disable_number_normalizationbooleanDefault: false

Set to True to turn off Nabrah's number normalization.

api_keystringDefault: env:NABRAH_API_KEY

Nabrah API key. Defaults to the NABRAH_API_KEY environment variable.

Additional resources

The following resources provide more information about using Nabrah with LiveKit Agents.