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

# Speech-to-Text Overview

> When to use the WebSocket API vs the REST endpoint, and how the pieces fit together

Gradium exposes Speech-to-Text over two transports. They share the same
models; pick the transport that matches your audio source and latency
needs.

## Choosing a model

Two kinds of Speech-to-Text model are available, selected with `model_name`:

* **`"default"`** — a standard transcription model. The transcription is
  produced in the language of the audio. Set `language` in `json_config`,
  or pass `"any"` to auto-detect.
* **`"stt-translate"`** — a translating transcription model. The
  transcription is generated in another language, which you choose with
  `language` (or `target_language`). See [Transcription Settings](https://docs.gradium.ai/guides/transcription-settings.md#languages).

Both kinds work identically over either transport.

## WebSocket vs REST

| If your audio is... | Use | Why |
| - | - | - |
| Live (microphone, telephony, agent loop) and you need sub-second turn-taking | [WebSocket](https://docs.gradium.ai/guides/speech-to-text.md) | Lowest latency. Push audio as it's captured, get text and VAD signals as they're produced. React to end-of-turn in real time. |
| A complete file you already have on disk or in memory | [REST](https://docs.gradium.ai/guides/speech-to-text-rest.md) | One HTTP POST with the audio in the body. No connection to manage; the server streams NDJSON results back as the response body. |
| In hand but you want VAD signals or to react to flush events | [WebSocket](https://docs.gradium.ai/guides/speech-to-text.md) | Use `stt_stream` (pull-based) over the WebSocket. Same low latency, no manual connection management. |
| Browser microphone or mobile client audio | [Browser WebSockets](https://docs.gradium.ai/guides/browser-websockets.md) | Use short-lived tokens instead of exposing an API key. |
| Telephony media streams | [Telephony Audio](https://docs.gradium.ai/guides/recipes/telephony-audio.md) | Use `ulaw_8000`, `alaw_8000`, or low-sample-rate PCM directly. |

If you're transcribing pre-recorded audio and don't need VAD, REST is
the simpler path. Move to WebSocket when you need live audio,
turn-taking, or in-stream `flush`.

## What both transports share

* **Models**: same `model_name` works on both.
* **Input formats**: PCM (multiple sample rates), WAV, Opus, mu-law, A-law.
* **Tunable options**: `temp`, `language`, `padding_bonus`, `delay_in_frames`, and a `keywords` dictionary for [boosting names and jargon](https://docs.gradium.ai/guides/transcription-settings.md#keyword-boosting), all via `json_config`. See [Transcription Settings](https://docs.gradium.ai/guides/transcription-settings.md).

## What's transport-specific

* **WebSocket-only**: semantic VAD `step` messages every 80 ms, in-stream `send_flush()` for forced processing, adaptive delay controls (`delay_in_frames`), setup-message stream controls (`send_setup_on_start`, `wait_for_ready_on_start`), browser tokens. See [WebSocket Lifecycle](https://docs.gradium.ai/guides/websocket-lifecycle.md).
* **REST-only**: send the full audio as the request body; receive NDJSON over a streaming response.

## Next steps

> [card] [Use the WebSocket API](https://docs.gradium.ai/guides/speech-to-text.md)
>
> Streaming audio in, transcripts and VAD signals out, with flush
> control.

> [card] [Use the REST API](https://docs.gradium.ai/guides/speech-to-text-rest.md)
>
> One-shot transcription of a complete audio file.

> [card] [Turn-taking recipe](https://docs.gradium.ai/guides/recipes/turn-taking.md)
>
> Use semantic VAD and adaptive delay to decide when an agent should answer.

> [card] [Keyword boosting recipe](https://docs.gradium.ai/guides/recipes/keyword-boosting.md)
>
> Recognize names, brands, and jargon by biasing STT toward a custom dictionary.

> [card] [GitHub examples](https://github.com/gradium-ai/gradbot/tree/main/demos)
>
> Browse complete voice-agent demos built with Gradium STT and TTS.

> [card] [Transcription settings](https://docs.gradium.ai/guides/transcription-settings.md)
>
> `language`, `temp`, `padding_bonus`, `delay_in_frames`.

> [card] [Errors](https://docs.gradium.ai/guides/errors.md)
>
> Error contracts across REST, WebSocket, and streamed responses.


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