# Create speech

`POST /v1/audio/speech`

Synthesizes `input` and returns the audio. By default the whole file is returned with a
`Content-Type` matching `response_format`. With `"stream": true` the response is raw PCM
(signed 16-bit little-endian, mono, 44.1 kHz) sent as it is generated, typically starting within
100-250 ms. With `"stream_format": "sse"` the response is `text/event-stream` carrying
`speech.audio.delta` events (base64 audio in `audio`) followed by one `speech.audio.done`.

Credit is debited up front (`input` characters). If the speech service fails before sending the
first byte, the credit is returned. `input` is limited to a deployment-configured maximum
(5,000 characters by default); use [async jobs](#tag/Jobs) for longer text.

## Request body

`application/json`

## Responses

- `200`: The generated audio.
- `400`: The request is invalid (`invalid_request`, `input_too_long`). `error.param` names the offending field when known.
- `401`: The API key is missing, malformed or revoked (`unauthorized`).
- `402`: Not enough credit (`insufficient_credit`). Top up in the dashboard.
- `404`: The model or voice does not exist (`model_not_found`, `voice_not_found`), or the route is unknown (`not_found`).
- `413`: The request body is too large (`request_too_large`).
- `429`: Too many requests per second for this key, or too many concurrent generations for the account (`rate_limited`). Retry after `Retry-After` seconds.
- `500`: Unexpected server error (`internal_error`). Retry; report the `x-request-id` if it persists.
- `503`: The speech service is temporarily unavailable (`upstream_unavailable`). Credit is refunded; retry with backoff.

Full schema: /openapi.public.yaml
