> ## 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.

# Mastra

> Use Lokutor for speech and transcription in Mastra agents through @mastra/voice-openai.

`@mastra/voice-openai` passes `options` to the OpenAI client, so a base URL override is enough.

```bash theme={null}
npm install @mastra/voice-openai
```

```ts theme={null}
import { OpenAIVoice } from '@mastra/voice-openai';

const options = { baseURL: 'https://api.lokutor.com/v1' };
const apiKey = process.env.LOKUTOR_API_KEY;

const voice = new OpenAIVoice({
  speechModel: { name: 'tts-1', apiKey, options },       // model name is ignored by Lokutor
  listeningModel: { name: 'whisper-1', apiKey, options },
  speaker: 'F1',                                          // F1-F5, M1-M5, or OpenAI names
});

const audio = await voice.speak('Hello from Lokutor.', { language: 'en' }); // WAV stream
const text = await voice.listen(audioStream, { filetype: 'wav', language: 'en' });
```

Notes:

* Audio is always WAV regardless of `responseFormat`, and transcription accepts WAV only: pass `filetype: 'wav'`.
* The model names are typed as `tts-1` / `whisper-1` in the package; Lokutor ignores them.
* `language` is forwarded in the request body (the package spreads extra options into it).
* Not supported through this class: Mastra's realtime voice (`@mastra/voice-openai-realtime`).

Verified against the live API with `@mastra/voice-openai` (speak, then listen on the result). A runnable copy is in
[lokutor-ai/openai-compatible-examples](https://github.com/lokutor-ai/openai-compatible-examples/tree/main/mastra).


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