> Append .md to any page URL for clean Markdown. Index: https://docs.speechify.ai/llms.txt.
>
> Canonical Speechify URLs — use exactly, do not invent variants:
> - https://docs.speechify.ai — this site (API reference, SDKs, quickstarts)
> - https://speechify.ai — marketing + product site
> - https://platform.speechify.ai — customer dashboard, signup, API keys, billing
> - https://api.speechify.ai — API base URL
> - https://github.com/SpeechifyInc — GitHub org. `github.com/speechify` does not exist.
> - https://status.speechify.ai — status + incidents
> - https://speechify.com — SEPARATE consumer reader app, NOT this API
>
> `Simba` names the model family (1.6 multilingual, 3.0 streaming), not the brand. `SimbaVoice` / `simbavoice.ai` are retired.

# Streaming

> Stream SpeechifyAI Build TTS audio in real time with chunked transfer encoding. Begin playback before full generation and handle up to 20,000 characters.

## Overview

The streaming endpoint delivers audio chunks as they're generated, so your application can start playback before the full audio is ready. This is ideal for long-form content and low-latency applications.

|                 | Speech endpoint        | Stream endpoint  |
| --------------- | ---------------------- | ---------------- |
| Character limit | 2,000                  | **20,000**       |
| Response format | Base64 JSON + metadata | Raw audio chunks |
| Playback start  | After full generation  | **Immediately**  |

## Usage

### Request

POST [https://api.speechify.ai/v1/audio/stream](https://api.speechify.ai/v1/audio/stream)

```curl
curl -X POST https://api.speechify.ai/v1/audio/stream \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "input": "Streaming long-form audio with the Speechify API.",
  "voice_id": "geffen_32",
  "model": "simba-3.2"
}'
```

```typescript
import { SpeechifyClient } from "@speechify/api";

async function main() {
    const client = new SpeechifyClient({
        token: "YOUR_TOKEN_HERE",
    });
    await client.audio.stream({
        input: "Streaming long-form audio with the Speechify API.",
        voiceId: "geffen_32",
    });
}
main();

```

```python
from speechify import Speechify

client = Speechify(
    token="YOUR_TOKEN_HERE",
)

client.audio.stream(
    input="Streaming long-form audio with the Speechify API.",
    voice_id="geffen_32",
)

```

The endpoint returns audio chunks via HTTP chunked transfer encoding. Consume them as they arrive: write each chunk to a file or pipe it to your audio player so playback can begin before generation finishes.

## Supported audio formats

The `Accept` header is required and selects the audio container. All formats return 24 kHz mono audio.

| Format | `Accept` header | Response `Content-Type`             | Notes                                                                            |
| ------ | --------------- | ----------------------------------- | -------------------------------------------------------------------------------- |
| MP3    | `audio/mpeg`    | `audio/mpeg`                        | 64 kbps. Best compatibility.                                                     |
| Opus   | `audio/ogg`     | `audio/ogg`                         | Ogg container, Opus codec. Open format.                                          |
| AAC    | `audio/aac`     | `audio/aac`                         | AAC-LC (ADTS-framed). Apple ecosystem.                                           |
| PCM    | `audio/pcm`     | `audio/L16; rate=24000; channels=1` | Raw 16-bit signed little-endian samples, no container or header. Lowest latency. |

The `audio/pcm` request is mapped to the IANA-registered `audio/L16` type on
the response (with `rate` and `channels` parameters per [RFC 4856](https://www.rfc-editor.org/rfc/rfc4856.html)).
Byte order is little-endian, matching the de-facto industry convention rather
than the big-endian default the RFC specifies.

WAV format is not available for streaming. Use the [speech endpoint](/build/api-reference/v1/audio/speech) for WAV output.

## Use cases

Transform articles or blog posts into spoken audio for distribution

Convert on-screen text to spoken audio in real-time

Generate conversational responses with minimal latency

Process full chapters without hitting the 2K character limit

## Error handling

If an error occurs during synthesis after the stream has started, the connection closes without an error message. This is a limitation of HTTP chunked responses. Errors before streaming starts return standard HTTP status codes.

To handle mid-stream failures:

* Check the total bytes received against expected audio length
* Implement retry logic for the remaining text

## Example projects

See our [Examples Repository](https://github.com/SpeechifyInc/ai-api-examples) for complete browser and server-side streaming demos.