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

# Choose an interface

> The SDKs, the HTTP API, the WebSocket API, the OpenAI-compatible route and the LiveKit and Pipecat plugins, and which one fits how your text arrives.

Streaming TTS speaks with one set of voices and models, bills the same characters and runs on the same hosts whichever way you call it. What differs is the shape of the conversation with the server. The HTTP API takes a whole text in one request and answers with the audio. The WebSocket API keeps one connection open for a whole conversation and speaks text as it arrives. The SDKs, the OpenAI-compatible route and the LiveKit and Pipecat plugins are ways of calling one of those two. Pick by how your text arrives and by what you already run.

| Interface | Protocol | Use it when |
| - | - | - |
| [Python and JavaScript SDKs](https://assemblyai.com/docs/tts/getting-started/quickstart.md) | Both | You write Python or Node.js and want the requests, the audio framing and the errors handled for you |
| [HTTP API](https://assemblyai.com/docs/tts/api-reference/http-api/overview.md) | HTTP | You have a whole sentence or text in hand, want a file, or call from a language without an SDK |
| [WebSocket API](https://assemblyai.com/docs/tts/connect-parameters.md) | WebSocket | Text arrives word by word, and one conversation should run on one connection with barge-in |
| [OpenAI-compatible route](https://assemblyai.com/docs/tts/openai-compatibility.md) | HTTP | Your code or framework already speaks the OpenAI speech API |
| [LiveKit plugin](https://assemblyai.com/docs/tts/livekit.md) | WebSocket | Your agent runs on LiveKit Agents |
| [Pipecat service](https://assemblyai.com/docs/tts/pipecat.md) | WebSocket | Your agent runs on Pipecat |

## Start with an SDK

The Python and JavaScript SDKs cover both protocols. `synthesize()` sends one text over HTTP and returns the whole audio, `stream()` sends one text over HTTP and yields the audio as it is made, and a session object speaks a conversation over one WebSocket connection with flush, cancel and the audio of each request in order. They also raise a refused request or a rejected session as a typed error, so you never parse an error body or frame yourself. The [Quickstart](https://assemblyai.com/docs/tts/getting-started/quickstart.md) shows all three, and every feature page shows its SDK form first.

Reach for the raw protocol when you work in another language, when you run in a browser or on a device without the SDK, or when you need something the SDK does not expose yet. The quickstart's cURL tab and its [direct WebSocket program](https://assemblyai.com/docs/tts/getting-started/quickstart.md#using-the-websocket-api-directly) are the starting points.

## Whole texts over HTTP

The [HTTP API](https://assemblyai.com/docs/tts/api-reference/http-api/overview.md) turns one text into speech in one request. The audio is the response body, streamed while it is synthesized by default or as a whole file on request, and it comes as raw PCM, G.711, WAV or MP3. A second route answers the audio together with the time at which each word is spoken. Every request stands alone, a failure is an HTTP status with a JSON body, and nothing has to be kept alive between requests.

This fits a voice agent that sends one request per sentence, a server that renders prompts or notifications to files, a script, and a page that calls the API with a [temporary token](https://assemblyai.com/docs/tts/authenticate-with-a-temporary-token.md). Keep the connection open between requests so only the first one pays for the handshake. Each request has its own character limit, which [Limits](https://assemblyai.com/docs/tts/limits.md) lists with the others.

## Conversations over WebSocket

The [WebSocket API](https://assemblyai.com/docs/tts/connect-parameters.md) holds one connection for a whole conversation. Each sentence is a request on it, text can be sent a token at a time as an LLM writes it, the server starts speaking once it holds whole sentences, and a cancel stops the request in flight for barge-in. Word boundaries arrive with the audio. The audio is raw codec bytes, PCM or G.711, with no file container, which is what a player that starts on the first bytes wants.

This fits anything that talks back and forth: a voice agent, a live assistant, a dictation reader. Opening a connection per sentence pays the handshake every time and runs into the limit on new sessions, so one session per conversation is the shape to aim for. [Message frames](https://assemblyai.com/docs/tts/message-frames.md) documents the protocol and [Audio formats](https://assemblyai.com/docs/tts/connect-parameters.md#audio-formats) the bytes.

## Already on the OpenAI speech API

If your code or framework calls the OpenAI speech API, point it at the [OpenAI-compatible route](https://assemblyai.com/docs/tts/openai-compatibility.md) with your AssemblyAI API key and it speaks with AssemblyAI voices without other changes. The OpenAI SDKs work this way, and so do the OpenAI plugins of LiveKit and Pipecat, though both frameworks also have native AssemblyAI plugins that run on the WebSocket API. It is the HTTP API with OpenAI's request fields and error body, so the native routes remain the place for WAV, G.711, buffered responses and word timings.

## Where to next

* [Quickstart](https://assemblyai.com/docs/tts/getting-started/quickstart.md): first audio with an SDK or cURL, then a conversation over one session.
* [HTTP API basics](https://assemblyai.com/docs/tts/api-reference/http-api/overview.md): hosts, authentication, response framing, audio formats, errors and limits of the HTTP routes.
* [WebSocket API basics](https://assemblyai.com/docs/tts/connect-parameters.md), [Message frames](https://assemblyai.com/docs/tts/message-frames.md) and the [WebSocket API reference](https://assemblyai.com/docs/tts/api-reference/websocket-api.md): the WebSocket API in full.
* [OpenAI compatibility](https://assemblyai.com/docs/tts/openai-compatibility.md): base URLs, models, voices and framework setups.
* [LiveKit](https://assemblyai.com/docs/tts/livekit.md) and [Pipecat](https://assemblyai.com/docs/tts/pipecat.md): the AssemblyAI plugins for the two frameworks.
