Skip to main content
lokutor-haystack adds two Haystack components: LokutorTextToSpeech and LokutorSpeechToText. Source: lokutor-ai/lokutor-haystack (Apache-2.0).

Install

The package is not on PyPI yet. Until it is:
The key is a Haystack Secret read from LOKUTOR_API_KEY, so it is never written into a serialized pipeline.

Text to speech

Calls POST /v1/tts/synthesize. voice is F1-F5, M1-M5 or a clone id; language is an ISO code (pass it for predictable results). run accepts voice and language overrides, and run_async exists. Limits are those of the REST API: 5,000 characters per call, WAV output (16-bit PCM, 44.1 kHz, mono).

Speech to text

Calls POST /v1/speech-to-text. sources are file paths or ByteStreams and the output is one Document per source. Lokutor decodes WAV only: convert other formats first. meta carries file_path, language_code, and, with diarize=True, speakers; with include_words=True the per-word timings in words. An unreadable file is logged and skipped; an API error raises RuntimeError with Lokutor’s message.

Pipeline example

What was tested

Unit tests with a mocked HTTP layer on haystack-ai 2.10.0 and 3.4.1, and one live round trip (a short sentence synthesized, then transcribed) against api.lokutor.com. Not run: non-English languages, diarization against the live API, run_async against the live API, or any real-world pipeline beyond the example above.