Files
learnharness/docs/stt.md
T

2.8 KiB

Speech recognition

Settings → Speech recognition contains the model, recognition language and preferred-language controls. The model picker offers two choices:

  • Nova-3 · Deepgram (the default): streams microphone audio directly to Deepgram using a short-lived token. Add a Deepgram API key under Providers.
  • MAI-Transcribe-2 · OpenRouter: records locally in memory and sends the complete recording in one request after Stop. Add an OpenRouter API key under Providers; the existing key also works if OpenRouter is already configured for chat. The permanent key stays on the server.

Both insert the transcript after recording finishes. OpenRouter displays Transcribing… while waiting. Sending a chat message or answer during recording waits for transcription before continuing. Cancel or Escape discards dictation; cancelling during transcription aborts the request and ignores late results. Navigating away releases the microphone and cancels pending transcription.

The interface language, recognition language, and STT model are saved independently. Model and language changes apply to the next recording, and their controls lock during recording/transcription. Existing settings continue to use Deepgram until another model is selected.

English and Russian select a single recognition language. Multilingual uses automatic language detection in MAI, including mixed-language speech. Its documented API accepts only one forced language and has no preferred-language list; saved RU/EN hints remain available for Deepgram and are disabled when MAI is selected. They are not sent as keyword hints or an ignored prompt.

OpenRouter audio is a lossless WAV container around the same 16 kHz mono PCM capture used for Deepgram. Stop drains the microphone's final partial frame before sending it. There is no speech splitting, silence removal, automatic provider fallback, or automatic transcription retry. The inline audio limit is 25 MB (about 13 minutes at this format); exceeding it stops recording with an error. Provider processing can time out for long recordings even within the size limit. Audio is not saved to disk.

The renderer sends WAV bytes to POST /api/stt/transcribe?model=microsoft/mai-transcribe-2&language=en|ru|multi. The server validates the model, language, WAV format and body size, reads OPENROUTER_API_KEY through the normal key store, and posts base64 audio to OpenRouter's dedicated transcription endpoint. Provider diagnostics are replaced with localized app errors, without returning credentials or audio. Offline tests mock all provider calls.

References: OpenRouter transcription API, MAI-Transcribe-2, Microsoft language and model options.