🎤Micdrop

Voxtral Realtime Speech to Text in Node.js

Real-time transcription with Voxtral Mini Transcribe Realtime 3, in more than 40 languages, with a final transcript in under half a second. It costs $0.008 per minute. MistralSTT connects to Mistral’s global endpoint, so pick Gladia or Gradium when the audio has to stay in the EU.

Voxtral also runs on its own. With stt as the server’s only option, you get a dictation tool that transcribes each sentence and stays quiet.

Installation

Terminal window
npm install @micdrop/mistral

The same package also provides an agent and a text to speech. The providers page shows what every provider covers.

Usage with MicdropServer

import { MistralSTT } from '@micdrop/mistral'
import { MicdropServer } from '@micdrop/server'
const stt = new MistralSTT({
apiKey: process.env.MISTRAL_API_KEY || '',
})
// Use with MicdropServer
new MicdropServer(socket, {
stt,
// ... other options
})

Usage without MicdropServer

import { MistralSTT } from '@micdrop/mistral'
import { createReadStream } from 'fs'
const stt = new MistralSTT({
apiKey: process.env.MISTRAL_API_KEY || '',
})
stt.on('Transcript', (text) => console.log('Transcript:', text))
stt.on('Failed', (chunks) => console.error('Failed:', chunks.length, 'chunks'))
// Audio is raw PCM, 16 bits, 16 kHz, mono
stt.transcribe(createReadStream('speech.pcm'))

Events

EventPayloadDescription
TranscriptstringTranscription of one utterance. The text is empty when nothing was recognized.
FailedBuffer[]Transcription gave up after its retries, with the audio chunks left pending.

See the STT interface for the full contract.

Options

OptionTypeDefaultDescription
apiKeystringRequiredYour Mistral AI API key
modelstring'voxtral-mini-transcribe-realtime-3-0'Realtime transcription model to use
encodingMistralAudioEncoding'pcm_s16le'Audio encoding of the incoming stream
targetStreamingDelayMsnumberOptionalTarget streaming delay in milliseconds
connectionTimeoutnumber5000Timeout in milliseconds for WebSocket connection
transcriptionTimeoutnumber4000Timeout in milliseconds to wait for transcription
retryDelaynumber1000Delay in milliseconds between reconnection attempts
maxRetrynumber3Maximum number of reconnection attempts before failing

Each stream given to transcribe() is one utterance and gets exactly one Transcript event, sent when Mistral finalizes the utterance after its flush. With no answer within transcriptionTimeout, the utterance is emitted with the text received so far, and the late answer is discarded so it never lands on the next utterance.

A connection that drops, even a clean close by Mistral, is opened again within a budget of maxRetry attempts in a row, retryDelay apart, and the audio of every utterance still waiting for its transcript is sent again. Once the budget runs out, Failed hands that audio back, and the next utterance tries to connect again.

The Micdrop client streams 16kHz PCM16 mono audio, which matches Voxtral’s default input format, so no resampling is required.

The previous model, voxtral-mini-transcribe-realtime-2602, still works through the model option.