---
title: "Synthesize PCM, chunked as it decodes"
method: POST
path: "/v1/synthesize/stream"
---

# Synthesize PCM, chunked as it decodes

`POST /v1/synthesize/stream`

The same body as POST /v1/synthesize, except the response body starts as soon as the first vendor chunk decodes instead of after the whole synthesis. Selection, failover and the routing headers all complete before the first byte; a vendor failure after that ends the body rather than switching voices mid-utterance.

## Headers

- `X-Speko-Objective` 'latency' | 'quality' | 'cost' | 'balanced'
- `X-Speko-Language` string
- `X-Speko-Allow` string
- `X-Speko-Deny` string
- `X-Speko-Max-Price` number

## Request body

- union — The text to speak, as "input" (OpenAI's field) or "text" (ours). Either is accepted on either streaming route.
  - object
    - `input` string, required
    - `text` string
    - `model` string
    - `voice` string — Provider voice id. Omit to use the provider default where supported.
    - `language` string — BCP 47 tag. Overrides X-Speko-Language for this request.
    - `speed` number
    - `response_format` 'pcm' | 'pcm16' — Streaming serves pcm only, and names the reason on a 400 for anything else: wav carries a total byte count in its 44-byte header so it cannot start before the audio is complete, and mp3 and opus would need an encoder in the audio path. POST /v1/audio/speech serves wav.
  - object
    - `input` string
    - `text` string, required
    - `model` string
    - `voice` string — Provider voice id. Omit to use the provider default where supported.
    - `language` string — BCP 47 tag. Overrides X-Speko-Language for this request.
    - `speed` number
    - `response_format` 'pcm' | 'pcm16' — Streaming serves pcm only, and names the reason on a 400 for anything else: wav carries a total byte count in its 44-byte header so it cannot start before the audio is complete, and mp3 and opus would need an encoder in the audio path. POST /v1/audio/speech serves wav.

## Response `200`

Signed 16-bit mono 24 kHz PCM, chunked as each vendor chunk decodes. x-speko-first-byte-ms is absent by design: it is not yet known when these headers are written, which is the point of the route.

## Other responses

- `503` — No streaming TTS provider is available for this request
- `default` — Error

---

[API](https://skmtc.net/speko/apis/speko-voice-router-api.md) · [All operations](https://skmtc.net/speko/apis/speko-voice-router-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/speko/speko-voice-router-api/versions/278edfaef74c/schema)
