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

# Realtime Transcription API

> Live speech to text over a WebSocket, on OpenAI's realtime transcription protocol.

For a runnable client, see [Speech to Text](https://docs.morphllm.com/models/speech-to-text.md#realtime).

## Connect

```
GET wss://api.morphllm.com/v1/realtime?intent=transcription
Authorization: Bearer YOUR_API_KEY
```

`intent=transcription` is required. Optional query parameters: `model` (`morph-transcribe-live`, the default, or `morph-transcribe`) and `chunk_ms`. A missing key, a bad query or full capacity is refused before the upgrade with the HTTP error (`401`, `400`, `429`). Client events are JSON text frames; every server event carries an `event_id`.

## Session

The server sends `session.created` on connect. Change settings any time with `session.update`; the server answers with `session.updated` and the full session.

```json theme={null}
{
  "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": { "type": "server_vad", "threshold": 0.5, "prefix_padding_ms": 300, "silence_duration_ms": 500 }
      }
    }
  }
}
```

| Field | Values |
| :- | :- |
| `audio.input.format` | `audio/pcm`, 16-bit little-endian mono, `rate` 24000 (default) or 16000 |
| `audio.input.transcription.model` | `morph-transcribe-live` (text arrives while the caller speaks) or `morph-transcribe` (see Dictation below) |
| `audio.input.transcription.language` | A locale or ISO 639-1 code; `null` detects it (default). `languages` with one entry also works |
| `audio.input.transcription.chunk_ms` | `320`, `560` (default), `1120`: the latency and accuracy dial. Morph extension. A change to a shorter chunk can be refused with a `rate_limit_exceeded` error event when capacity is full; the session keeps its current size |
| `audio.input.turn_detection` | `server_vad` with `threshold` (0 to 1), `prefix_padding_ms` (0 to 2000), `silence_duration_ms` (100 to 10000), or `null` for manual commits |

`transcription.prompt` and `transcription.keywords` are refused: the streaming model takes no context. `noise_reduction` and `include` are ignored.

## Dictation: upload while speaking, transcribe on release

Set the model to `morph-transcribe` and `turn_detection` to `null`. Send `input_audio_buffer.append` while the microphone is open and `input_audio_buffer.commit` when it closes. The audio is already on the server when the turn ends, so nothing is left to upload: the turn is transcribed by the file model when it ends and comes back as `delta` events followed by `completed`.

```json theme={null}
{
  "type": "session.update",
  "session": {
    "type": "transcription",
    "audio": { "input": {
      "format": { "type": "audio/pcm", "rate": 16000 },
      "turn_detection": null,
      "transcription": { "model": "morph-transcribe", "language": "en", "style": "clean", "keyterms": ["Morph"] }
    } }
  }
}
```

| Field | Values |
| :- | :- |
| `audio.input.transcription.language` | ISO 639-1 code; omit to detect it |
| `audio.input.transcription.prompt` | Context for names and vocabulary |
| `audio.input.transcription.keyterms` | Words and phrases to spell correctly |
| `audio.input.transcription.style` | `verbatim` (default) or `clean`, which drops fillers and false starts |

Each turn is billed as `morph-transcribe` for the audio in that turn, and `completed` carries `usage` in tokens. A turn longer than about 45 seconds is cut where the speaker pauses and its pieces are transcribed at the same time, so the wait after release stops growing with the turn. Such a turn appears as several requests in your usage, for the same total audio. A turn holds up to 60 minutes of audio. With `server_vad` instead of `null`, each detected stretch of speech becomes its own turn. If capacity is full when a turn ends, that turn fails with `rate_limit_exceeded` and the session stays open.

## Client events

| Event | Fields | Effect |
| :- | :- | :- |
| `session.update` | `session` | Changes the session |
| `input_audio_buffer.append` | `audio`: base64 PCM in the session format | Adds audio to the current turn |
| `input_audio_buffer.commit` | | Ends the current turn. Required when `turn_detection` is `null` |
| `input_audio_buffer.clear` | | Drops the current turn's audio |

## Server events

| Event | Fields | When |
| :- | :- | :- |
| `session.created` | `session` | On connect |
| `session.updated` | `session` | After each `session.update` |
| `input_audio_buffer.speech_started` | `audio_start_ms`, `item_id` | Voice activity detection heard speech start |
| `input_audio_buffer.speech_stopped` | `audio_end_ms`, `item_id` | Speech stopped for `silence_duration_ms` |
| `input_audio_buffer.committed` | `item_id`, `previous_item_id` | A turn ended, by detection or by your commit |
| `input_audio_buffer.cleared` | | After `input_audio_buffer.clear` |
| `conversation.item.input_audio_transcription.delta` | `item_id`, `content_index`, `delta` | New text for the turn. Deltas only append |
| `conversation.item.input_audio_transcription.completed` | `item_id`, `content_index`, `transcript`, `usage` | The turn's final transcript. `usage` is `{"type": "duration", "seconds"}` |
| `conversation.item.input_audio_transcription.failed` | `item_id`, `content_index`, `error` | The turn could not be transcribed |
| `error` | `error`: `type`, `code`, `message`, `param`, `event_id` | A client event was invalid or could not be applied. The session stays open |

Deltas arrive while the turn is still open, so text shows up as the speaker talks.

## Billing

A session bills every second of audio appended, silence included, at $4.40 per 1M input tokens (12.5 tokens per second, $0.198 per audio hour), as one usage row when the session closes.


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