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

# OpenAI-compatible audio API

> Use Lokutor from any client that speaks OpenAI's audio API (Open WebUI, LiteLLM, Home Assistant, the OpenAI SDKs) by changing the base URL and the key.

Lokutor answers OpenAI's two audio endpoints, so tools that support an OpenAI-compatible speech provider work with Lokutor by pointing them at `https://api.lokutor.com/v1` with your Lokutor API key.

| OpenAI endpoint | Lokutor | Notes |
| :- | :- | :- |
| `POST /v1/audio/speech` | [text to speech](https://docs.lokutor.com/api-reference/rest.md#post-/tts/synthesize-—-tts-synthesis) | JSON `{model, input, voice, speed}` |
| `POST /v1/audio/transcriptions` | [speech to text](https://docs.lokutor.com/api-reference/speech-to-text.md) | multipart `file`, optional `language` |

Billing, limits and errors are those of the underlying endpoints, at the [published rates](https://api.lokutor.com/v1/pricing).

## Text to speech

```bash theme={null}
curl https://api.lokutor.com/v1/audio/speech \
  -H "Authorization: Bearer $LOKUTOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "tts-1", "input": "Hello from Lokutor.", "voice": "alloy"}' \
  --output hello.wav
```

* `model` is accepted and ignored: every request uses Versa 2.0.
* `voice` takes OpenAI's names, mapped to Lokutor voices (`alloy`→`F1`, `nova`→`F2`, `shimmer`→`F3`, `coral`→`F4`, `sage`→`F5`, `echo`→`M1`, `onyx`→`M2`, `fable`→`M3`, `ash`→`M4`, `ballad`→`M5`), or any Lokutor voice directly (`F1`, `es_f3`, a cloned voice id).
* `language` is a Lokutor extra field (`en`, `es`, `ca`, `gl`, `eu`, `pt`, `fr`, `it`, `de`); without it the text decides.
* **The audio is always WAV**, whatever `response_format` asks for. Clients that play the file or hand it to an audio element work; a client that insists on MP3 bytes does not.

## Speech to text

```bash theme={null}
curl https://api.lokutor.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $LOKUTOR_API_KEY" \
  -F file=@call.wav -F model=whisper-1 -F language=es
```

`response_format` can be `json` (default, `{"text": ...}`), `text`, or `verbose_json` (adds `language`, `duration` and per-word times). `srt` and `vtt` are not supported. WAV audio only, as in the [speech-to-text API](https://docs.lokutor.com/api-reference/speech-to-text.md).

## OpenAI SDK

```python theme={null}
from openai import OpenAI

client = OpenAI(base_url="https://api.lokutor.com/v1", api_key="your_lokutor_key")
with client.audio.speech.with_streaming_response.create(model="tts-1", voice="alloy", input="Hello") as r:
    r.stream_to_file("hello.wav")
text = client.audio.transcriptions.create(model="whisper-1", file=open("hello.wav", "rb")).text
```

## Open WebUI, LiteLLM and others

In Open WebUI's **Admin → Settings → Audio**, choose the OpenAI engine for both text to speech and speech to text, set the base URL to `https://api.lokutor.com/v1`, paste your key, and give the voice (`alloy` or a Lokutor voice). In LiteLLM, use the `openai/` prefix with `api_base="https://api.lokutor.com/v1"`.


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