---
title: "Synthesize speech"
method: POST
path: "/v1/audio/speech"
---

# Synthesize speech

`POST /v1/audio/speech`

OpenAI-compatible TTS input. Speko maps the request into each eligible adapter's wire format and normalizes every provider to signed 16-bit mono PCM at 24 kHz. response_format selects raw PCM or a WAV container at the Speko edge. Model and voice are optional so a language-tagged accent route can supply them. The legacy gemini:gemini-3.1-flash-tts-preview model id remains accepted as an alias for google-tts:gemini-3.1-flash-tts-preview.

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

- object
  - `model` string — Optional. Defaults to auto so a language-tagged accent route can supply the model. Legacy alias ids are accepted as input only; the route header and /v1/models report the canonical id.
  - `instructions` string — Optional TTS delivery direction. Used by Gemini TTS to control speaking style or accent without changing the transcript.
  - `voice` string — Optional provider voice id or compatibility preset. Omit it when an X-Speko-Language accent route supplies the voice.
  - `input` string, required
  - `response_format` 'pcm' | 'pcm16' | 'wav' — Caller-facing container. pcm and pcm16 return raw signed 16-bit mono PCM at 24 kHz; wav adds a RIFF/WAVE header and buffers the complete response. Encoded formats are rejected before any upstream request.

## Response `200`

Signed 16-bit mono PCM at 24 kHz, either raw or in a WAV container according to response_format.

## Other responses

- `502` — Every attempted upstream failed before the router could complete the request. Route, reason, and failover-count headers are present; X-Speko-First-Byte-Ms is omitted.
- `default` — Router-generated errors use the Speko JSON error schema. A non-retryable upstream 4xx is passed through after response-header sanitization with its upstream status, media type, and body, which can be non-JSON.

---

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