# Spraaksynthese

**API:** Model API

**Endpoint:** `POST /api/v1/audio/speech`

**Tags:** Audio

Use model to select the speech generation model. Channel selection is unavailable for speech generation requests.

## Base URL

- `https://openapi.felo.ai` — Productie

## Authentication

- `FeloBearerAuth` (http bearer) — Felo API-sleutel verzonden als `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo API-sleutel verzonden als `X-API-Key: <key>`.

## Request body

Required: **yes**

### application/json

Schema:

```json
{
  "type": "object",
  "required": [
    "model",
    "input"
  ],
  "additionalProperties": false,
  "properties": {
    "model": {
      "type": "string",
      "maxLength": 256
    },
    "input": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    },
    "voice": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Optional non-blank voice ID. The upstream model determines whether a voice is required and which IDs it accepts. Catalog voices are examples."
    },
    "response_format": {
      "type": "string",
      "enum": [
        "pcm",
        "mp3"
      ],
      "default": "pcm"
    },
    "speed": {
      "type": "number",
      "default": 1,
      "description": "Currently only 1 is supported."
    }
  }
}
```

## Responses

### 200 — Succes levert audiobytes: MP3 als `audio/mpeg` of ruwe PCM als `audio/pcm`, geen WAV, JSON of SSE. Controleer HTTP-status en volledige overdracht voor afspelen. `--fail` voorkomt HTTP-foutteksten in het audiobestand. Verwijder onvolledige bestanden na een onderbreking. Vraag de PCM-parameters van het kanaal op; raad ze niet. STT gebruikt `input_audio_second` of tokens; TTS gebruikt `input_character`. Bij `speech_billing_unit` tellen `utf16_code_unit` en `unicode_code_point` emoji anders. De reservering is geen uitgavenlimiet; afrekening kan asynchroon zijn. Ontbrekend bewijs betekent niet gratis. Beide accepteren `X-Felo-Channel` en versturen eenmaal naar het gekozen kanaal. Zet automatische herhalingen, ook in SDK's, uit na timeout of verbreking. Bewaar `X-Request-Id` en beschikbare `X-Generation-Id`. Console Playground ondersteunt audio nog niet. `configured_rates` gebruikt vastgezette tarieven en geverifieerd gebruik; `upstream_cost` gebruikt geverifieerde leverancierskosten met gepubliceerde opslag en korting.

**audio/mpeg**

Schema: string, (binary)

```json
{
  "type": "string",
  "format": "binary"
}
```

**audio/pcm**

Schema: string, (binary)

```json
{
  "type": "string",
  "format": "binary"
}
```
