---
name: voicelab-asr
description: Speech-to-text with the VoiceLab ASR API (https://asr.voicelab.ai), an OpenAI-compatible API for Polish
  phone calls, recordings and live audio. Use when writing code that transcribes audio with VoiceLab ASR or the model
  voicelab/moonlight-lvcsr, when choosing its parameters, reading its responses or errors, or answering questions about its accounts,
  API keys, limits, billing and privacy.
---

# VoiceLab ASR API

VoiceLab ASR turns speech into text: transcripts of recordings (one request per file), live audio over a WebSocket, speaker diarization, AI correction of the transcript, a quality (WER) estimate per transcript. Language: Polish.
It is compatible with OpenAI's audio API, so the OpenAI SDKs and plain HTTP both work: only the base URL, the key and
the model change. Run by VoiceLab (Voicelab.ai Sp. z o.o., Gdańsk, Poland); audio is processed in Poland.

- Site, sign-up, API keys, balance: https://asr.voicelab.ai
- API base URL: `https://asr.voicelab.ai/api/v1`
- Live audio: `wss://asr.voicelab.ai/api/v1/realtime?intent=transcription`
- Support: asr@voicelab.ai

## Getting access

1. Sign up at https://asr.voicelab.ai (Google, Microsoft, e-mail and password). A new account gets 1 hour of audio free to try it.
2. In the dashboard, create an API key. It is shown only once: store it as a secret (e.g. `VOICELAB_API_KEY`), never in
   code or in a repository. Keys can be revoked and replaced at any time.
3. Send the key in every request: `Authorization: Bearer <key>`.

Never ask the user to paste their API key into a chat; read it from an environment variable.

## Models

| model | language | audio |
|---|---|---|
| `voicelab/moonlight-lvcsr` | Polish | telephony, 8 kHz |

8 kHz models are for phone calls and contact-center audio. Pick the model by the audio, not by the file's sample rate (a phone call saved at 44.1 kHz is still
telephony); audio at another sample rate is converted. The list of models for the key: `GET https://asr.voicelab.ai/api/v1/models`.

## Transcribe a recording

`POST https://asr.voicelab.ai/api/v1/audio/transcriptions` (multipart/form-data).

| parameter | meaning |
|---|---|
| `file` | the recording (multipart file). Formats: wav, mp3, flac, ogg/opus, m4a, webm, amr. Up to 60 minutes and 256 MB per request. |
| `model` | `voicelab/moonlight-lvcsr`. The model fixes the language and the audio quality; audio at another sample rate is converted. |
| `response_format` | `json` (default: `text` and `usage`), `text`, `verbose_json` (segments and words with start and end times), `srt`, `vtt`, `diarized_json` (segments with their speaker; implies diarization). |
| `timestamp_granularities[]` | `segment` (default) and/or `word`, for `verbose_json`. |
| `multichannel` | `true` (default): each channel of a stereo or multi-channel recording is transcribed on its own (e.g. agent and customer apart), billed per channel. `false`: channels are mixed into one, billed once. |
| `keywords[]` | words and names to recognize in this request, one per field, e.g. `keywords[]=VoiceLab`. Spell them as they should appear; write numbers as words. Words kept for every request go into the account's Dictionary (https://asr.voicelab.ai/dictionary). |
| `diarize` | `false` (default) or `true`: who spoke when; every segment and word gets a speaker `A`, `B`, … in the order they first speak. Included in the price. |
| `correction` | `false` (default) or `true`: after recognition an AI correction model listens to the recording again and fixes misrecognized words; the text gets punctuation, capitals and numbers in words. Word times and speakers are kept. The uncorrected text is in `correction.asr_text`. Not available in live audio. |
| `estimate_wer` | `false` (default) or `true`: the word error rate estimated without a reference text: `wer_estimate` with `wer` (percent) and `quality` (`good` up to 10, `acceptable` up to 20, `poor` above), also in the `X-WER-Estimate` header. An estimate (about 6 points off on average): use it to pick recordings to review. |

```bash
curl https://asr.voicelab.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $VOICELAB_API_KEY" \
  -F file=@call.wav -F model=voicelab/moonlight-lvcsr -F response_format=json
# {"text": "Dzień dobry, w czym mogę pomóc?", "usage": {"type": "duration", "seconds": 2.9}}
```

```python
import os
from openai import OpenAI

client = OpenAI(base_url="https://asr.voicelab.ai/api/v1", api_key=os.environ["VOICELAB_API_KEY"])
with open("call.wav", "rb") as f:
    result = client.audio.transcriptions.create(
        model="voicelab/moonlight-lvcsr", file=f,
        response_format="verbose_json", timestamp_granularities=["segment", "word"],
        extra_body={"keywords": ["VoiceLab"]},  # parameters the SDK does not know go in extra_body
    )
print(result.text)
for w in result.words:
    print(w.start, w.end, w.word)
```

```javascript
import OpenAI from "openai";
import fs from "node:fs";

const client = new OpenAI({ baseURL: "https://asr.voicelab.ai/api/v1", apiKey: process.env.VOICELAB_API_KEY });
const result = await client.audio.transcriptions.create({
  model: "voicelab/moonlight-lvcsr", file: fs.createReadStream("call.wav"), response_format: "json",
});
console.log(result.text);
```

Who spoke when (one line per speaker turn):

```bash
curl https://asr.voicelab.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $VOICELAB_API_KEY" \
  -F file=@meeting.mp3 -F model=voicelab/moonlight-lvcsr -F response_format=text -F diarize=true
# Speaker A: Dzień dobry, w czym mogę pomóc?
# Speaker B: Chciałbym zmienić taryfę.
```

### Responses

- `json`: `{"text": ..., "usage": {"type": "duration", "seconds": ...}}`.
- `verbose_json`: `task`, `language`, `duration`, `text`, `segments` (`id`, `start`, `end`, `text`, `speaker`),
  `words` (`word`, `start`, `end`, `confidence`, `speaker`) with `timestamp_granularities[]=word`,
  `usage`; for a multi-channel recording also `channels` (`channel`, `text`, `duration`), and the segments and words
  carry their channel as the speaker.
- `diarized_json`: `segments` with `start`, `end`, `text`, `speaker` (`A`, `B`, …).
- `text`, `srt`, `vtt`: plain text and subtitles.
- Times are in seconds from the start of the recording. `usage.seconds` is what the request is billed (the audio
  length, times the channels when they are transcribed apart).
- Every response has the `X-Balance-Seconds` header: the account's remaining balance in seconds of audio.
- A `notice` field, when present, explains something the API decided (e.g. channels mixed); show it to the user.

## Live audio (WebSocket)

`wss://asr.voicelab.ai/api/v1/realtime?intent=transcription`, in the format of OpenAI's Realtime API (transcription sessions). The key goes in
the `Authorization` header, or from a browser as the subprotocol `openai-insecure-api-key.<key>`.

1. Send `session.update` with `{"session": {"type": "transcription", "audio": {"input": {"format": {"type": ...},
   "transcription": {"model": "voicelab/moonlight-lvcsr", "keywords": [...]}, "turn_detection": ...}}}}`.
2. Stream audio in `input_audio_buffer.append` events (base64): `audio/pcm` (16-bit, 24 kHz, mono), `audio/pcmu` or
   `audio/pcma` (G.711, 8 kHz, e.g. a phone line).
3. Read `conversation.item.input_audio_transcription.delta` (words as they become final) and
   `...completed` (`transcript` of the utterance, `usage.seconds`).

Utterances are found by the server (`turn_detection: {"type": "server_vad"}`, the default; `threshold`,
`silence_duration_ms`, `prefix_padding_ms` as in OpenAI's API) or ended by the client with
`input_audio_buffer.commit` (`turn_detection: null`). Billed per second of the utterances; silence between them is
free. A session closes after 10 minutes without events, and after 4 hours at most.

```python
import asyncio, base64, os
from openai import AsyncOpenAI  # pip install "openai[realtime]"

async def transcribe_live(chunks):  # chunks: an async iterator of 20 ms G.711 mu-law frames
    client = AsyncOpenAI(base_url="https://asr.voicelab.ai/api/v1", api_key=os.environ["VOICELAB_API_KEY"])
    async with client.realtime.connect(extra_query={"intent": "transcription"}) as conn:
        await conn.session.update(session={"type": "transcription", "audio": {"input": {
            "format": {"type": "audio/pcmu"}, "transcription": {"model": "voicelab/moonlight-lvcsr"}}}})

        async def send():
            async for chunk in chunks:
                await conn.input_audio_buffer.append(audio=base64.b64encode(chunk).decode())
        asyncio.create_task(send())

        async for event in conn:
            if event.type == "conversation.item.input_audio_transcription.completed":
                print(event.transcript)
```

## Limits

- One recording: up to 60 minutes and 256 MB.
- Requests at the same time per account: 2 unless agreed otherwise; more get `429`
  with `Retry-After`. Send long batches through a small queue (2 at a time), not all at once.
- An account may also have a daily limit of audio (`429 daily_limit_exceeded`).
- Need more? Write to asr@voicelab.ai.

## Errors

Errors come as JSON in OpenAI's shape: `{"error": {"message", "type", "param", "code"}}`.

| HTTP | code | what to do |
|---|---|---|
| 400 | `audio_too_long` | split the recording (at most 60 minutes) |
| 400 | `too_many_channels` | mix the channels (`multichannel=false`) or split them |
| 400 | `empty_audio`, `decoding_timeout` | the file is damaged or not audio: convert it (e.g. to 16-bit PCM wav) |
| 400 | `invalid_keywords` | fix `keywords[]` (words only, numbers written as words) |
| 401 | `invalid_api_key` | check the key; it may have been revoked |
| 402 | `insufficient_balance` | the prepaid hours are used up: buy more in the dashboard |
| 403 | `account_blocked` | contact asr@voicelab.ai |
| 404 | `model_not_found` | use a model id from `GET /models` |
| 413 | `file_too_large` | at most 256 MB: compress (e.g. mp3/opus) or split |
| 429 | `rate_limit_exceeded` | too many requests at once: wait `Retry-After` seconds and retry |
| 429 | `daily_limit_exceeded` | the account's daily limit: continue tomorrow (UTC) or ask support |
| 5xx | | temporary: retry with a back-off (e.g. 2, 4, 8 s); failed requests are not billed |

## Billing

Prepaid: hours of audio are bought in advance and used per second of audio, per transcribed channel. A failed request
costs nothing. Balance, usage per request and invoices are in the dashboard (https://asr.voicelab.ai); usage can be downloaded as CSV.
Packages of prepaid hours (gross prices, paid by BLIK, bank transfer or card in the dashboard):
- 25 hours: 15.00 PLN (0.60 PLN per hour)
- 100 hours: 59.00 PLN (0.59 PLN per hour)
- 500 hours: 249.00 PLN (0.50 PLN per hour)
- 1500 hours: 649.00 PLN (0.43 PLN per hour)
- 5000 hours: 1990.00 PLN (0.40 PLN per hour)
Volume pricing: asr@voicelab.ai.

## Privacy

Recordings and transcripts are processed only to answer the request, in Poland, and are not stored afterwards or used to
train models. Details: https://asr.voicelab.ai/privacy, terms: https://asr.voicelab.ai/terms.

## Transcribing from an AI assistant (MCP)

For people who want their assistant to transcribe files itself (not to write code):

- Remote MCP server `https://asr.voicelab.ai/api/mcp` (Streamable HTTP, the API key in the `Authorization: Bearer` header), for
  assistants with a terminal (Claude Code, Cursor, VS Code, Codex, Gemini CLI…). Claude Code:
  `claude mcp add --transport http voicelab-asr https://asr.voicelab.ai/api/mcp --header "Authorization: Bearer <your key>"`. Tools: `list_models`, `upload_url` (a one-time link; the assistant sends the
  recording to it with `curl -T`) and `transcribe` (the upload, with the parameters above; `save_to_file` returns a
  one-time link to save a long transcript with `curl -o` instead of the text).

## Tips for assistants

- Prefer the OpenAI SDK with `base_url="https://asr.voicelab.ai/api/v1"`; parameters the SDK does not know (`keywords`, `diarize`, `correction`, `estimate_wer`, `multichannel`) go in `extra_body`.
- For call-center stereo recordings keep `multichannel=true`: each side is transcribed apart and words keep their
  channel.
- For names, products and jargon pass `keywords[]` (or use the account's Dictionary): it is the main way to improve
  recognition of rare words.
- Read `X-Balance-Seconds` and warn the user before the balance runs out.
- This file is the official description of the public API: https://asr.voicelab.ai/skill.md. Anything not described here is not part of
  the API.
