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

# Speech to Text

> Transcribe and translate audio files, or stream live transcripts over a WebSocket. OpenAI-compatible.

Two speech models behind OpenAI's audio endpoints. The OpenAI SDK works with the base URL changed to `https://api.morphllm.com/v1`.

| Model | Built on | Use it for | Price |
| :- | :- | :- | :- |
| `morph-transcribe` | NVIDIA Nemotron 3.5 Transcribe 30B-A4B (34B total, 4.3B active) | Recorded audio up to 60 minutes: transcripts, translation, speaker labels, word timestamps, subtitles | \$0.18 per audio hour |
| `morph-transcribe-live` | NVIDIA Nemotron 3.5 ASR Streaming 0.6B | Live audio over a WebSocket, transcribed while the speaker talks. Also takes files, for a plain transcript. | \$0.198 per audio hour |

Use `morph-transcribe` for anything already recorded. Use `morph-transcribe-live` when you need the words while they are being spoken: voice agents, live captions, dictation.

| Endpoint | What it does |
| :- | :- |
| [`POST /v1/audio/transcriptions`](https://docs.morphllm.com/api-reference/endpoint/audio-transcriptions) | Audio in, text out. Multipart `file`, or JSON with a `url` |
| [`POST /v1/audio/translations`](https://docs.morphllm.com/api-reference/endpoint/audio-translations) | Audio in, translated text out |
| [`wss://api.morphllm.com/v1/realtime?intent=transcription`](https://docs.morphllm.com/api-reference/endpoint/realtime-transcription) | Live transcription on OpenAI's realtime protocol |

## First request

Set your [Morph API key](https://www.morphllm.com/dashboard/api-keys), then transcribe a 10-second public sample by URL:

```bash theme={null}
export MORPH_API_KEY="YOUR_API_KEY"

curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "morph-transcribe", "url": "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac"}'
```

The clip is a LibriSpeech reading that begins "He hoped there would be stew for dinner". The response carries the transcript and what it used:

```json theme={null}
{
  "text": "He hoped there would be stew for dinner, ...",
  "usage": { "type": "duration", "seconds": 10.435, "input_tokens": 131, "output_tokens": ... }
}
```

With the OpenAI SDK, upload a local file. Download the sample first:

```bash theme={null}
curl -L -o sample.flac https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac
```

> [tab] Python
>
> ```python theme={null}
> import os
> from openai import OpenAI
>
> client = OpenAI(api_key=os.environ["MORPH_API_KEY"], base_url="https://api.morphllm.com/v1")
>
> with open("sample.flac", "rb") as audio:
>     transcript = client.audio.transcriptions.create(model="morph-transcribe", file=audio)
>
> print(transcript.text)
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> // transcribe.mjs
> import fs from "node:fs";
> import OpenAI from "openai";
>
> const client = new OpenAI({ apiKey: process.env.MORPH_API_KEY, baseURL: "https://api.morphllm.com/v1" });
>
> const transcript = await client.audio.transcriptions.create({
>   model: "morph-transcribe",
>   file: fs.createReadStream("sample.flac"),
> });
>
> console.log(transcript.text);
> ```

Any format ffmpeg decodes works: mp3, wav, flac, m4a, ogg, webm, and video files such as mp4 (the first audio track is used).

## Options

The OpenAI fields work as on OpenAI. Morph adds named options for the things the model was trained to do.

| Field | What it does |
| :- | :- |
| `file` or `url` | Exactly one. `url` is an https link the API fetches |
| `model` | `morph-transcribe` or `morph-transcribe-live` |
| `language` | ISO 639-1 code or locale (`en`, `en-US`). Omit it for audio in any supported language |
| `prompt` | Context about the audio: the topic, names, the setting |
| `keyterms[]` | Names and jargon to spell correctly, up to 100 |
| `style` | `verbatim` (default) or `clean` |
| `diarize` | Speaker labels |
| `tag_audio_events` | Non-speech event and speaking style tags in the text |
| `timestamp_granularities[]` | `word` or `segment`; either returns both. Needs `verbose_json` |
| `response_format` | `json` (default), `text`, `verbose_json`, `srt`, `vtt` |
| `stream` | Server-sent events with text deltas |

Options combine. This request spells two names correctly, drops fillers, and labels speakers with word timestamps, all at once:

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac \
  -F model=morph-transcribe \
  -F "keyterms[]=mutton" \
  -F "keyterms[]=turnips" \
  -F style=clean \
  -F diarize=true \
  -F response_format=verbose_json \
  -F "timestamp_granularities[]=word"
```

Only requests that contradict themselves are refused with a 400: timestamps without `verbose_json`, `stream` with `verbose_json`, `srt`, `vtt` or `diarize`, or transcription options sent to `morph-transcribe-live`.

There is no system prompt on the transcription endpoints. The model card says to leave the system prompt empty for transcription and translation, so each option sets one clause of the card's own instruction instead; free-form instructions would take requests off the tested path. `prompt` is context about the audio, not an instruction.

`morph-transcribe-live` takes `file` or `url`, `model`, `language`, `response_format` (`json`, `text`, or `verbose_json` without words) and `stream`.

## Key terms and context

Pass names and jargon in `keyterms[]` (one form field per term) and a sentence about the audio in `prompt`:

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac \
  -F model=morph-transcribe \
  -F "keyterms[]=mutton" \
  -F "keyterms[]=turnips" \
  -F "prompt=An audiobook reading of a novel."
```

Up to 100 terms; `prompt` and `keyterms` together hold up to 2,000 characters. Newlines and angle brackets are dropped. In the OpenAI SDK, pass them as `extra_body={"keyterms": ["mutton", "turnips"]}`.

## Verbatim or clean

`style: verbatim` (the default) writes what was said, fillers and repetitions included. `style: clean` drops fillers ("um", "uh") and accidental repetitions and keeps every other word as spoken.

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac -F model=morph-transcribe -F style=clean
```

## Speaker labels and word timestamps

Ask for `verbose_json` with word timestamps, and `diarize` for speaker labels:

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac \
  -F model=morph-transcribe \
  -F response_format=verbose_json \
  -F "timestamp_granularities[]=word" \
  -F diarize=true
```

```json theme={null}
{
  "task": "transcribe",
  "duration": 10.435,
  "text": "He hoped there would be stew for dinner, ...",
  "words": [
    { "word": "He", "start": 0.56, "end": 0.72, "speaker": 0 },
    { "word": "hoped", "start": 0.72, "end": 1.04, "speaker": 0 }
  ],
  "segments": [
    { "id": 0, "start": 0.56, "end": 10.08, "text": "He hoped there would be stew for dinner, ...", "speaker": 0 }
  ],
  "usage": { "type": "duration", "seconds": 10.435, "input_tokens": 131, "output_tokens": ... }
}
```

* `segments[]`: runs of speech from one speaker, with `speaker`, `start`, `end` and `text`. With `diarize`, plain `json` carries `segments` too, so you get speakers without asking for `verbose_json`.
* `words[]`: each word with `start` and `end` in seconds, and `speaker` when `diarize` is on (else `null`).
* `text`: always plain. Speaker labels never appear inline. Speaker labels work in 13 languages.
* `language`: the spoken language as a lowercase English name, present only when known (for example, when you sent `language`).

Timestamps without `diarize` return the words and segments with `speaker: null`.

Word times are returned only when they cover the whole transcript; a partial word list is never returned. On some recordings, mostly long ones where several people talk over each other, the times cannot be placed for every word. The response then keeps `text` and the speaker `segments` (with `start` and `end` set to `null`), leaves out `words`, and carries `"timestamps_incomplete": true` with the header `x-morph-timestamps-incomplete: true`. The transcript itself is complete and billed as usual.

## Audio events

`tag_audio_events: true` keeps the model's non-speech tags in the text: events as `<ev:*>` and speaking style as `<sty:*>`. Without it, those tags are removed.

## Subtitles

`response_format: srt` or `vtt` returns subtitles cut from word timestamps. A cue holds up to 7 seconds and 84 characters and breaks at the end of a sentence or a change of speaker. With `diarize`, `vtt` cues carry a `<v Speaker N>` voice tag.

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac -F model=morph-transcribe -F response_format=srt
```

```
1
00:00:00,560 --> 00:00:04,960
He hoped there would be stew for dinner, turnips and carrots and bruised potatoes
```

A subtitle file is only its times, so when word times cannot be placed for the audio the request returns a 422 `timestamps_unavailable` and is not billed. Request `json` or `text` to get the transcript.

## Translation

`POST /v1/audio/translations` transcribes and translates in one step, into English by default. Set `target_language` (a code or an English name) to translate from English into another language.

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/translations \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac -F model=morph-transcribe -F target_language=de
```

Translation runs into English from any of ar, bg, cs, da, de, el, es, et, fi, fr, he, hi, hr, hu, it, ja, ko, lt, lv, mt, nl, pl, pt, ro, ru, sk, sl, sv, th, uk and zh, or from English into any of them. It takes `morph-transcribe` only, with `prompt`, `keyterms[]`, `stream` and the `json`, `text` and `verbose_json` formats. `style: clean`, `diarize`, `tag_audio_events`, timestamps and subtitles are refused with a 400: the model's translation task has no wording, speaker or event clause, and word times align the source speech, not the translation. With the OpenAI SDK, `client.audio.translations.create(model="morph-transcribe", file=audio)` returns English.

## Large files by URL

For audio that is already online, or too large to upload comfortably, send JSON with `url` instead of `file`. Every other field is the same, with arrays as JSON arrays:

```bash theme={null}
curl --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "morph-transcribe",
    "url": "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
    "response_format": "verbose_json",
    "timestamp_granularities": ["word"]
  }'
```

The URL must be https and resolve to a public address. The API follows up to 3 redirects and allows 5 minutes for the download. A presigned S3, GCS or R2 link works.

## Streaming

Set `stream: true` to receive the transcript as server-sent events while it is written. Streaming works with the `json` and `text` formats.

```bash theme={null}
curl -N --fail-with-body https://api.morphllm.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $MORPH_API_KEY" \
  -F file=@sample.flac -F model=morph-transcribe -F stream=true
```

```
data: {"type": "transcript.text.delta", "delta": "He hoped there would be stew"}

data: {"type": "transcript.text.delta", "delta": " for dinner,"}

data: {"type": "transcript.text.done", "text": "He hoped there would be stew for dinner, ...", "usage": {"type": "tokens", "input_tokens": 131, "output_tokens": ..., "total_tokens": ...}}
```

The stream ends after `transcript.text.done`; there is no `[DONE]` line. If the engine fails mid-stream, the last event is `{"type": "error", "error": {...}}`.

## Realtime

`morph-transcribe-live` speaks [OpenAI's realtime transcription protocol](https://docs.morphllm.com/api-reference/endpoint/realtime-transcription.md), so OpenAI realtime transcription clients connect with the URL and model changed. Connect to `wss://api.morphllm.com/v1/realtime?intent=transcription` with your key in the `Authorization` header, send `session.update`, then base64 PCM audio. The server sends text deltas and one completed transcript per turn.

This script streams the sample and prints the transcript. It needs `ffmpeg` and `pip install "websockets>=14"`:

```python theme={null}
import asyncio, base64, json, os, subprocess
import websockets

URL = "wss://api.morphllm.com/v1/realtime?intent=transcription"
CHUNK = 4800  # 100 ms of 24 kHz 16-bit mono audio

async def main():
    pcm = subprocess.run(
        ["ffmpeg", "-v", "error", "-i", "sample.flac", "-ac", "1", "-ar", "24000", "-f", "s16le", "-"],
        capture_output=True, check=True,
    ).stdout
    headers = {"Authorization": f"Bearer {os.environ['MORPH_API_KEY']}"}
    async with websockets.connect(URL, additional_headers=headers) as ws:
        await ws.send(json.dumps({"type": "session.update", "session": {"type": "transcription", "audio": {"input": {
            "format": {"type": "audio/pcm", "rate": 24000},
            "transcription": {"model": "morph-transcribe-live", "language": "en", "chunk_ms": 320},
            "turn_detection": None,
        }}}}))
        for i in range(0, len(pcm), CHUNK):
            audio = base64.b64encode(pcm[i:i + CHUNK]).decode()
            await ws.send(json.dumps({"type": "input_audio_buffer.append", "audio": audio}))
        await ws.send(json.dumps({"type": "input_audio_buffer.commit"}))
        async for message in ws:
            event = json.loads(message)
            if event["type"] == "conversation.item.input_audio_transcription.delta":
                print(event["delta"], end="", flush=True)
            elif event["type"] == "conversation.item.input_audio_transcription.completed":
                print()
                break
            elif event["type"] == "error":
                raise RuntimeError(event["error"]["message"])

asyncio.run(main())
```

`turn_detection: None` makes the script end the turn itself with `input_audio_buffer.commit`. Leave it out for a microphone: server voice activity detection then opens a turn when speech starts and commits it after 500 ms of silence.

Session settings, in `session.audio.input`:

| Setting | Values |
| :- | :- |
| `format` | `{"type": "audio/pcm", "rate": 24000}` (default) or `rate: 16000`. 16-bit little-endian mono |
| `transcription.model` | `morph-transcribe-live`, or `morph-transcribe` for [dictation](https://docs.morphllm.com/api-reference/endpoint/realtime-transcription.md#dictation-upload-while-speaking-transcribe-on-release): one transcript per turn from the file model |
| `transcription.language` | A locale or ISO 639-1 code, or `null` to detect it (the default). One language per session |
| `transcription.chunk_ms` | `320`, `560` (default) or `1120`. Shorter chunks return words sooner; longer chunks are more accurate |
| `turn_detection` | `{"type": "server_vad", "threshold", "prefix_padding_ms", "silence_duration_ms"}` (defaults 0.5, 300, 500), or `null` to commit turns yourself |

`chunk_ms` and `language` are Morph extensions to OpenAI's session. `chunk_ms` can also be set at connect time with `?chunk_ms=`. The model card lists 40 locales; the 32 below transcribe out of the box (its transcription-ready and broad-coverage tiers), and the 8 adaptation-ready locales need fine-tuning, so they are not accepted: en-US, en-GB, es-US, es-ES, fr-FR, fr-CA, it-IT, pt-BR, pt-PT, nl-NL, de-DE, tr-TR, ru-RU, ar-AR, hi-IN, ja-JP, ko-KR, vi-VN, uk-UA, pl-PL, sv-SE, cs-CZ, nb-NO, da-DK, bg-BG, fi-FI, hr-HR, sk-SK, zh-CN, hu-HU, ro-RO and et-EE; a bare code such as `de` picks the first locale for it.

The full event list is on the [realtime reference](https://docs.morphllm.com/api-reference/endpoint/realtime-transcription.md).

## Limits

| | Limit |
| :- | :- |
| Audio per request | 60 minutes |
| File or URL size | 180 MB |
| Files per request | 1 |
| `prompt` plus `keyterms` | 2,000 characters, 100 terms |
| Transcript length | `ceil(audio seconds x 16) + 256` tokens, about 4 times normal speech |
| Realtime audio | 16-bit PCM mono at 24 kHz or 16 kHz |

## Errors

Errors use the OpenAI envelope: `{"error": {"message", "type", "param", "code"}}`.

| Status | `code` | When |
| :- | :- | :- |
| 400 | | Missing or invalid field, a contradictory request, unsupported language, a `url` that is not https or does not resolve publicly, audio that cannot be decoded |
| 401 | `invalid_api_key` | Missing or invalid key |
| 402 | `monthly_quota_exceeded` | Your monthly spend limit is reached |
| 413 | `file_too_large`, `audio_too_long` | Over 180 MB, or over 60 minutes |
| 422 | `timestamps_unavailable` | `srt` or `vtt` was requested and word times could not be placed for this audio. Not billed. Request `json` or `text` |
| 429 | `rate_limit_exceeded` | Your rate limit, or speech capacity is full. Retry with backoff |
| 502 | | The speech engine failed on this request. Retry |

On the WebSocket, a bad event returns an `error` event and the session stays open; a failed turn returns `conversation.item.input_audio_transcription.failed`.

## Usage and billing

Audio bills as input tokens at 12.5 tokens per second of audio, rounded up: 45,000 per audio hour, metered every 80 ms with no minimum. Only audio is billed; the instruction, `prompt` and `keyterms` are not, so the price is exactly per audio hour. Output tokens are free. Key terms and speaker labels have no surcharge.

| Model | Per 1M input tokens | Per audio hour | Per audio minute |
| :- | :- | :- | :- |
| `morph-transcribe` | \$4.00 | \$0.18 | \$0.003 |
| `morph-transcribe-live` | \$4.40 | \$0.198 | \$0.0033 |

`json` and `verbose_json` responses carry `usage`: `seconds` of audio, `input_tokens` billed (`ceil(seconds x 12.5)`), `output_tokens` free. A response whose transcript ends before the audio does carries `"truncated": true` and the header `x-morph-truncated: true`. That happens when the transcript hit the length cap, which points to a model repetition loop and not a long file, or when the model stopped transcribing and the text was cut at that point. The API checks each file transcript for both and for an early ending, and may run the audio a second time before answering; you are billed once. A streamed response reports usage in `transcript.text.done`; a realtime turn reports its `seconds` in the completed event, and a realtime session bills every second of audio appended, silence included. The [usage dashboard](https://www.morphllm.com/dashboard/usage) shows audio hours under Speech to text.

## Not in v1

Async jobs with webhooks, PII redaction, multichannel audio, and enrolled known speakers. The models do none of these natively.


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