Skip to main content
Standalone transcription, with no language model and no voice. Use STTClient for a single recorded clip, or SpeechToTextClient for live transcription from a microphone. Recognition covers all nine languages (English, Spanish, Catalan, Galician, Basque, Portuguese, French, Italian and German) with one model; pass the language when you know it (Which languages are understood).

Batch transcription

STTClient sends one complete audio clip to POST /stt/transcribe and returns the transcript.

Options

Accepted audio: WAV with 8- or 16-bit PCM, mono or stereo, at 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100 or 48000 Hz, up to 10 MB. Anything else is refused with validation.invalid_request_format.

Result

Live transcription

SpeechToTextClient streams microphone audio to WS /ws/stt. The server detects where each utterance ends: you get partial transcripts while the user is speaking and a final transcript once they stop. An utterance ends after about 0.7 s without speech, so a short pause between words does not split a sentence, and its final transcript is one recognition pass over the whole utterance (up to 30 s; longer ones are finalised in parts). Stretches with no speech in them, such as background noise or breathing, are not transcribed.

Options

endUtterance() / end_utterance() finalizes the utterance in progress and ends the session: the server sends the last final transcript, then closes. Use it for a “done” button; connect again to transcribe more.

Raw /ws/stt protocol

  1. Connect to wss://api.lokutor.com/ws/stt with a credential (Authentication).
  2. Send a JSON first message: {"language": "en"}, or {"language": ""} to have the language detected. Add "keyterms": ["…"] for custom vocabulary.
  3. The server answers {"type": "status", "data": "ready", "lang": "en"}.
  4. Send binary frames of 16-bit PCM, 16 kHz, mono (about 20 ms each).
  5. The server sends {"type": "transcript", "data": "…", "isFinal": false, "lang": "en"} while the user speaks, and isFinal: true when the utterance ends.
  6. Send {"type": "end"} to finalize the current utterance and end the session: the server sends any final transcript, then {"type": "status", "data": "done"}, and closes.
Errors arrive as {"type": "error", "data": "…"}, with a plain string in data. Each open stream counts as one of your account’s concurrent sessions, together with voice-agent calls and /ws/tts sockets (3 before the first top-up, 10 after; Limits). Past that limit the handshake is refused with 429 and the JSON error auth.rate_limited (“Too many concurrent speech recognition sessions”), before the socket opens; close a stream you no longer need and retry. A stream’s session is released as soon as it closes.

Which one do I want?

  • A file the user already recorded or uploaded → STTClient.transcribe().
  • Live captions, dictation, or transcribing what’s coming from a microphone right now → SpeechToTextClient.
  • Building a full voice conversation (LLM responds, TTS speaks back) → VoiceAgentClient instead — it already includes STT as part of the turn.