> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lokutor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex

> Transcribe audio into LlamaIndex Documents and give agents Lokutor text-to-speech and speech-to-text.

Two [LlamaIndex](https://www.llamaindex.ai) packages, both from [lokutor-ai/llama-index-lokutor](https://github.com/lokutor-ai/llama-index-lokutor) (Apache-2.0):

| Package | Class | Use |
| :- | :- | :- |
| `llama-index-readers-lokutor` | `LokutorReader` | Audio file to `Document` (speech to text, optional diarization) |
| `llama-index-tools-lokutor` | `LokutorToolSpec` | Agent tools `text_to_speech` and `transcribe_audio` |

They are not on PyPI yet. Until they are, install from the repository subdirectories:

```bash theme={null}
pip install llama-index-readers-lokutor
pip install llama-index-tools-lokutor
export LOKUTOR_API_KEY=your_key
```

## Reader

```python theme={null}
from llama_index.core import VectorStoreIndex
from llama_index.readers.lokutor import LokutorReader

reader = LokutorReader(language="en", diarize=True)  # language=None detects it
docs = reader.load_data("meeting.wav")
index = VectorStoreIndex.from_documents(docs)
```

`load_data` / `aload_data` take a path, bytes or a file-like object and return one `Document`; metadata has `file_path`, `language_code`, and with `diarize=True` the `speakers`. Calls [`POST /v1/speech-to-text`](https://docs.lokutor.com/api-reference/speech-to-text). **WAV only**: convert MP3/M4A first.

## Agent tools

```python theme={null}
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.lokutor import LokutorToolSpec

spec = LokutorToolSpec(voice="F1", language="en")
agent = FunctionAgent(tools=spec.to_tool_list(), llm=OpenAI(model="gpt-4.1"))
```

`text_to_speech(text, output_path, voice=None, language=None)` writes a WAV via [`POST /v1/tts/synthesize`](https://docs.lokutor.com/api-reference/rest) and returns the path; `transcribe_audio(audio_path, language=None)` returns the transcript of a WAV file.

## Why a separate repository

LlamaIndex's contribution guide states that the main repository no longer accepts new integration packages, so these are maintained and published independently.

## What was tested

Unit tests with a mocked HTTP layer, and one live round trip per package (a short sentence synthesized, then transcribed) against `api.lokutor.com`, on llama-index-core as resolved at build time on 2026-11-03. Not run: an LLM-driven agent calling the tools, the async reader against the live API, non-English languages, or diarization against the live API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.