---
title: "OpenAI-compatible streaming speech"
method: POST
path: "/v1/audio/speech/stream"
---

# OpenAI-compatible streaming speech

`POST /v1/audio/speech/stream`

POST /v1/audio/speech with the response body chunked as it decodes. Point the standard OpenAI TTS client in LiveKit or Pipecat here to trade whole-utterance latency for first-sample latency. Both "input" and "text" are accepted.

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